Skip to content

Instantly share code, notes, and snippets.

@leecade
Created March 17, 2013 17:55
Show Gist options
  • Save leecade/5182759 to your computer and use it in GitHub Desktop.
Save leecade/5182759 to your computer and use it in GitHub Desktop.
toggle app frontmost with applescript
on alfred_script(q)
--todo: Record the last open position
set appName to "Finder"
set startIt to false
tell application "System Events"
if not (exists process appName) then
set startIt to true
else if frontmost of process appName then
set visible of process appName to false
else
set frontmost of process appName to true
end if
end tell
if startIt then
tell application appName to activate
end if
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment