[Joe Block](mailto:jpb@ApesSeekingKnowledge.net) writes: *"I ran into an issue with Automator workflows that call unix shell scripts. I've detailed it [here](http://digitalhominid.blogspot.com/2005/05/automator-and-shell-scripts.html), but it boils down to if you have a workflow that sends filenames to the unix script, you need to add an extra Applescript step to sanitize the file names.*
*Just put a* Run Applescript *action ahead of the* Run Shell Script *action, and put the below code in. It'll take the list of file aliases and convert them to properly quoted paths for the shell script to act on."*
on run {input, parameters}
set output to {}
repeat with i from 1 to length of input
set x to item i of input
set output to output & {quoted form of POSIX path of x}
end repeat
return output
end run
Excellent! I was going to need this during the next few days for a workflow. Thanks.
Comment by Peter Dekkers — May 20, 2005 @ 5:13 pm
I just wanted to note that I didn’t write that script – Mike Ashley from the Automator-Users list did
Comment by Joe Block — May 21, 2005 @ 11:04 am
Yes– I should have pointed that out in the posting.
By they way, anyone interested in signing up for the Automator (or any other) list, go to http://lists.apple.com/mailman/listinfo
Comment by Steve — May 21, 2005 @ 11:25 am
No problem, I just wanted to make sure that I gave him credit for his assistance.
Comment by Joe Block — May 21, 2005 @ 3:42 pm
That’s really cool. Thanks. But come someone tell me how to then use that parameter in the next shell script?
Comment by Paul — May 22, 2005 @ 10:28 am
If you are creating the shell script yourself, you can always use the quoted form of the path in the script in the script itself. i.e. “$path” (the variable in quotes).
Comment by jgrafix — November 30, 2007 @ 9:04 pm