Categories
AppleScript Notes

See if an application is running

tell application “Finder” to set itStatus to exists process “iTunes”

This will fail if the app name is different, which is common (on a mac it is usually a Bad Thing to rely on names or paths). I would rather use the creator code (“hook” in iTunes’ case):

tell application “Finder” to set itStatus to (“hook” is in creator type of every process) –> returns true if iTunes is running

If you don’t know the signature of your app, ask for it:

tell application “Finder” to return creator type of process “theApp” –> returns theApp’s creator code if it is currently running