Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created January 24, 2012 23:11
Show Gist options
  • Select an option

  • Save roxlu/1673389 to your computer and use it in GitHub Desktop.

Select an option

Save roxlu/1673389 to your computer and use it in GitHub Desktop.
Applescript which makes sure an application keeps running, with options to activate/hide the app.
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
on hideDock()
tell application "System Events"
keystroke "d" using [command down, option down]
end tell
end hideDock
on hideApp(appName)
tell application "Finder"
set visible of process appName to false
end tell
end hideApp
on showApp(appName)
tell application "Finder"
set visible of process appName to true
end tell
end showApp
on makeActive(appName)
tell application appName
activate
end tell
end onMakeActive
repeat
if appIsRunning("ApplicationName") then
makeActive("ApplicationName")
else
do shell script "open -a /path/to/ApplicationName.app"
end if
delay 10
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment