Posted By

iloveitaly on 07/04/10


Tagged

applescript name process application app exit quit


Versions (?)

Quit Application by Process Name


 / Published in: AppleScript
 

  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  

You need to login to post a comment.