This has been driving me crazy. I have a script which is an executable within /usr/local/bin/
, which works perfectly in Terminal, but I am unable to get Applescript to call it:
RunShell("estc R505")
on RunShell(oscript)
do shell script oscript
end RunShell
doesn't do a thing. I have tried giving the actual location /usr/local/bin/estc
instead, and calling it in bash with bash or sh… nothing works. It should return a text string, and works perfectly in terminal.
Best Answer
In Script Editor, if you run the following AppleScript command:
You'll see how the
PATH
is defined to thedo shell script
command:You need to include the fully qualified pathname to any executable that's not in the
PATH
, shown above, in order for it to work in an AppleScriptdo shell script
command.Another option is to add an
export PATH
command to thedo shell script
command, e.g.:And in your case, use it as, e.g.:
Obviously adjust the
...
portion ofexport PATH=$PATH:...
to reflect your actualPATH
that's not included in the defaultPATH
passed to thedo shell script
command as shown further above.