View Full Version : Topic : script to open application, and to quit if already open

Nov 18, 2010, 12:03 PM
I already have the script for launching one or more applications, and I could make a new one to quit them, but I was hoping it could be made into the same script. Can this be done?

here's what I have now:

tell application "Firefox" to activate

tell application "BetterTouchTool" to activate

Nov 19, 2010, 11:36 AM
set appName to "Terminal"
tell application "System Events" to set counter to the count of (processes whose name is appName)
if counter = 0 then
tell application appName to activate
tell application appName to quit
end if