• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Killing an app on X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Killing an app on X


  • Subject: Killing an app on X
  • From: Jon Pugh <email@hidden>
  • Date: Tue, 14 May 2002 15:26:39 -0700

One of the boys here asked me how to kill an app with AppleScript on X. I thought others might like to see how.

on forceQuit(appName)
set pid to word 1 of (do shell script ("ps -xo,pid,command | grep \"" & appName & "\" | head -n 1"))
do shell script ("kill -9 " & pid)
end forceQuit

forceQuit("Clock")


That's all there is to it. Use the PS (processes) command to get the PID (process ID) and then use the KILL command to stop it, with extreme prejudice (-9).

Unix, icky but functional.

Jon
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Killing an app on X
      • From: Timothy Bates <email@hidden>
    • Re: Killing an app on X
      • From: garbanzito <email@hidden>
References: 
 >Re: Briskets (perl) (From: Lee Azzarello <email@hidden>)

  • Prev by Date: Re: Briskets (perl)
  • Next by Date: Re: [OT] Quicktime Movies
  • Previous by thread: Re: Briskets: plain English
  • Next by thread: Re: Killing an app on X
  • Index(es):
    • Date
    • Thread