Include paths in AppleScript shell commands

Jun 17, '02 09:37:01AM

Contributed by: Robert M

Many people have trouble when doing a shell script through applescript even when the shell script works perfectly in the Terminal. A common problem is that the command that you're using with "Do shell script" works in the Terminal (tcsh for most) but doesn't work with zsh that applescript uses when you invoke "Do shell script". To get the command to work , you have to specify the pathway to the command for the applescript to be able to use it.

To get the pathway to a command, simply type "which " and the command while in the Terminal. Then press "return." For example:

 % which chown
Gives you /usr/sbin/chown as output.

So in the AppleScript, don't type do shell script "chown etc...". Instead, type do shell script "/usr/sbin/chown etc...". Now it works, yay! :)

Comments (1)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020617093701406