Skip to content

Instantly share code, notes, and snippets.

@dpk
Created June 11, 2015 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpk/a92d3ea83aa7142e3317 to your computer and use it in GitHub Desktop.
Save dpk/a92d3ea83aa7142e3317 to your computer and use it in GitHub Desktop.
Restart frontmost application with AppleScript (revised version of my script from c. 2011)
tell application "System Events" to set _app to the name of the first process whose frontmost is true
tell application _app
quit
set _isRunning to true
repeat while (_isRunning)
delay 1
tell application "System Events"
set _isRunning to ((name of processes) contains _app)
end tell
end repeat
end tell
tell application _app to activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment