OS X Automator: Using custom command in AppleScript’s “do shell script”

applescriptautomatorbash

I have recently asked a question about automatically inserting a value produced by a custom executable into a prompt field. Please look over this post to know exactly what I am talking about.

The reply I got was exactly what I was looking for except for one but crucial detail.

To make things short: I am looking for a way to make do shell script to accept custom executables. Running my custom command vpnpw in terminal works perfectly fine. However, AppleScript's do shell script says it's unknown.

Does anyone know how to make these custom executables available globally?

Best Answer

What's the fully qualified pathname of the executable? If it's not within in the $PATH that's passed to the do shell script command, which is /usr/bin:/bin:/usr/sbin:/sbin, then you'll need to use the fully qualified pathname of the executable.

To make an executable available globally, it must be in a directory that's included in the $PATH.

You can also add an alias or symbolic link to the target executable to a directory that's in the $PATH if you do not want to either append the path to it in the $PATH however keep in mind if the executable is dependent on files that are within its directory then adding the directory path to the $PATH is what you'll need to do.