• 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
Re: stopping an application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stopping an application


  • Subject: Re: stopping an application
  • From: Bill Janssen <email@hidden>
  • Date: Mon, 13 Apr 2009 17:42:32 PDT
  • Comments: In-reply-to Nick Zitzmann <email@hidden> message dated "Sun, 12 Apr 2009 19:27:53 -0700."

Nick Zitzmann <email@hidden> wrote:

>
> On Apr 12, 2009, at 7:48 PM, Bill Janssen wrote:
>
> > I was afraid of that...  Is there an easy way to do that from the
> > command line given its PID?
>
>
> Not really. First, you need a window server connection; you cannot
> send Apple events without one. Second, you need to get a PSN for the
> PID. Third, you need to craft and send a quit event to the PSN. The
> first thing can be accomplished by calling NSApplicationLoad(). For
> the other two, you can probably find sample code on the Web or in the
> archives.

Thanks.  This is pretty easy to do on the commandline with osascript:

  % osascript -e 'tell application foo to quit'

And instead of saying "foo", you can say,
"/Applications/Utilities/foo.app", or whereever it comes from.

  % osascript -e 'tell application "/Applications/Utilities/foo.app" to quit'

Still haven't figured out how to do it from the PID yet.  It's possible,
just not a one-liner.

Bill
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: stopping an application
      • From: Uli Kusterer <email@hidden>
References: 
 >stopping an application (From: Bill Janssen <email@hidden>)
 >Re: stopping an application (From: Nick Zitzmann <email@hidden>)
 >Re: stopping an application (From: Bill Janssen <email@hidden>)
 >Re: stopping an application (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Best way to get a non-repeating random number?
  • Next by Date: Re: stopping an application
  • Previous by thread: Re: stopping an application
  • Next by thread: Re: stopping an application
  • Index(es):
    • Date
    • Thread