I often find my ARDAgent process goes haywire what with all the IPSEC tunnels I work with. It became a chore having to relaunch it from the CLI or using Activity Monitor so I blasted out a clumsy Applescript to do it for me.
The script could theoretically kill a different process if you so wished.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | property process_found : false property process_to_quit : "ARDAgent" on run tell application "System Events" if process process_to_quit exists then set process_found to true end if end tell if process_found = true then activate display dialog ¬ "Are you sure you wish to quit " & process_to_quit & "?" with icon 1 ¬ buttons {"Cancel", "Quit"} ¬ default button "Quit" set button_pressed to button returned of result if button_pressed is "Quit" then tell application process_to_quit to quit end if else display dialog ¬ process_to_quit & " is not running." with icon 1 ¬ buttons {"Quit"} ¬ default button "Quit" end if end run |








Bookmarks about Applescript
September 23, 2008 at 5:15 pm
[...] - bookmarked by 1 members originally found by Dermika on 2008-09-07 Applescript to Quit Process http://www.theonlyjames.com/2008/07/applescript-quit-process/ - bookmarked by 5 members originally [...]