open programs with applescript

Try this. Notice you use “-e” when you are writing the command. Without “-e” you would give a path to an applescript to run. Also notice the string command must be in quotes.

osascript -e "tell application \"iTunes\" to activate"

And if you have a multi-line applescript you use “-e” before each line like this…

osascript -e "tell application \"iTunes\"" -e "activate" -e "end tell"

If you want to open an application just use the unix “open” command…

open "/path/to/application"

If you wanted to open an application using applescript and the “activate” command doesn’t work (it should work for almost everything though) then tell the Finder to open it. Remember that applescript uses colon delimited paths…

osascript -e "tell application \"Finder\" to open file \"path:to:application\""

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)