groups

info


tags: applescript,toggle,on/off,on,off

Link to this snippet:


Download to Code Collector

language: AppleScript
licence: Other

On-Off_AppToggle

options: send to code collectorview all seydoggy's snippets
-- On-Off App Toggle

-- By Adam Merrifield <http://www.seydoggy.com>
-- r1 10-02-09 11:04

-- replace "YourAppName" with your app
set yourApp to "YourAppName"

-- leave the rest to us
if appIsRunning(yourApp) then
	tell application yourApp to quit
else
	tell application yourApp to activate
end if

on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning