Jump to content

bin/osascript: return-command passes additional line break


Recommended Posts

I have found a bug with the Run Script Action when using osascript. The "result" command always passes on the String with a linebreak at the end, although there shouldnt be one. The problem does not occur when using the Run NSApplescript Action with exactly the same one-line-command.

 

I have put together a small demo showing the problem:

https://www.dropbox.com/s/tsk88mnwyojmgdt/demo.alfredworkflow?dl=0

Link to post
12 hours ago, armenaton said:

I have found a bug with the Run Script Action when using osascript.

 

I’m not sure it’s strictly a bug (in Alfred). /usr/bin/osascript always adds a linebreak to output.

 

Changing Alfred to remove the final linebreak could unfortunately break existing scripts that expect it to be there.

Link to post

Is there a reason to do so with one Scripting action but not the other? It took me actually a while to figure out Alfred does this, as I kept looking for errors in my code. 

 

Also makes some further actions a bit intransparent, e.g. Alfreds Conditional Utility does not recognize the line break as \n, but (seemingly) only in its "invisible" form.

Edited by armenaton
Link to post
1 hour ago, armenaton said:

Is there a reason to do so with one Scripting action but not the other? It took me actually a while to figure out Alfred does this, as I kept looking for errors in my code. 

 

Alfred isn’t doing anything. It returns whatever the interpreter returns. And for some reason, /usr/bin/osascript always adds an extra newline.

 

1 hour ago, armenaton said:

Alfreds Conditional Utility does not recognize the line break as \n

 

Yeah. This is a known issue with a few of Alfred's text fields. Requiring actual newlines is not great UX.

Link to post
  • Andrew changed the title to bin/osascript: return-command passes additional line break

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...