Quit Application by Process Name


/ Published in: AppleScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. -- this function quits the app based on its process name, NOT its application name
  2. -- based on code here: http://codesnippets.joyent.com/posts/show/1124
  3. -- we need to use the pid, none of the AE apis returned the right name for "tell application x to quit"
  4.  
  5. on quit_app(process_name)
  6. if app_is_running(process_name) then
  7. tell application "System Events"
  8. set appID to unix id of application process process_name
  9. end tell
  10.  
  11. do shell script "kill " & appID
  12. end if
  13. end quit_app

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.