Re: stopping an application

2009-04-15 Thread Greg Guerin
Anders Holm wrote: I don't see any mention of considering sending a signal to PID xyz? See the original post: http://lists.apple.com/archives/cocoa-dev/2009/Apr/msg00886.html -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: stopping an application

2009-04-15 Thread Anders Holm
I don't see any mention of considering sending a signal to PID xyz? SIGTERM should do the trick here if the PID is known. Well behaved processes should listen to and trap OS layer signals as well. "man kill" in your friendly terminal program will reveal more. Nothing Cocoa (or other GUI) rel

Re: stopping an application

2009-04-13 Thread Jeremy W. Sherman
A caveat: typeApplicationBundleID just picks whichever target if there is more than one instance of an app with the same bundle id running. This can be the case if, for example, you're running both the current version of PowerPoint and an older version. typeProcessSerialNumber will always target th

Re: stopping an application

2009-04-13 Thread Uli Kusterer
On 14.04.2009, at 02:42, Bill Janssen wrote: % osascript -e 'tell application "/Applications/Utilities/foo.app" to quit' Avoid building and executing scripts if there's API. I hate tearing people a new one because they build a script and incorrectly escape special characters. E.g. imagin

Re: stopping an application

2009-04-13 Thread Bill Janssen
"From the command line"... Luca C. wrote: > 2009/4/13 Bill Janssen > > > > > > I was afraid of that... Is there an easy way to do that from the > > command line given its PID? > > > Using an AppleEvent given the appropriate bundle id of the application is > actually pretty easy.I have found

Re: stopping an application

2009-04-13 Thread Bill Janssen
James W. Walker wrote: > tell app "System Events" to set x to file of first process whose unix > id is 902 > tell app (POSIX path of x) to quit Thanks, that "unix id is xxx" was what I was looking for. > Hmm, now what did this have to do with Cocoa? I didn't have to do this till I started usin

Re: stopping an application

2009-04-13 Thread Bill Janssen
Greg Guerin wrote: > Bill Janssen wrote: > > > I was afraid of that... Is there an easy way to do that from the > > command line given its PID? > > Use the osascript command. > > Form a query using a 'whose' clause to select the process ID. I > forget what the exact wording is, or whether to

Re: stopping an application

2009-04-13 Thread Bill Janssen
Nick Zitzmann 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, y

Re: stopping an application

2009-04-13 Thread Luca C.
2009/4/13 Bill Janssen > > > I was afraid of that... Is there an easy way to do that from the > command line given its PID? Using an AppleEvent given the appropriate bundle id of the application is actually pretty easy.I have found this in one my quite old project: + (OSStatus)quitApplicationW

Re: stopping an application

2009-04-13 Thread Andrew Farmer
On 12 Apr 09, at 23:55, Arjun SM wrote: Use the 'do shell script' command do shell script kill -9 PID That should work. No, actually, don't do that. We are discussing Cocoa programming here. Running an Applescript that executes a shell script command that wraps a system call is an incredib

Re: stopping an application

2009-04-12 Thread Arjun SM
Use the 'do shell script' command do shell script kill -9 PID That should work. On Mon, Apr 13, 2009 at 10:08 AM, James W. Walker wrote: > > On Apr 12, 2009, at 8:55 PM, Greg Guerin wrote: > > Bill Janssen wrote: >> >> I was afraid of that... Is there an easy way to do that from the >>> comm

Re: stopping an application

2009-04-12 Thread James W. Walker
On Apr 12, 2009, at 8:55 PM, Greg Guerin wrote: Bill Janssen wrote: I was afraid of that... Is there an easy way to do that from the command line given its PID? Use the osascript command. Form a query using a 'whose' clause to select the process ID. I forget what the exact wording is,

Re: stopping an application

2009-04-12 Thread Greg Guerin
Bill Janssen wrote: I was afraid of that... Is there an easy way to do that from the command line given its PID? Use the osascript command. Form a query using a 'whose' clause to select the process ID. I forget what the exact wording is, or whether to ask Finder or System Events, so you

Re: stopping an application

2009-04-12 Thread Nick Zitzmann
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. Thir

Re: stopping an application

2009-04-12 Thread Bill Janssen
Nick Zitzmann wrote: > > On Apr 12, 2009, at 11:21 AM, Bill Janssen wrote: > > > What's the right way to have another process stop an application? > > > Send it the "quit" Apple event. > > Nick Zitzmann > I was afraid of that... Is there an easy way to do that

Re: stopping an application

2009-04-12 Thread Nick Zitzmann
On Apr 12, 2009, at 11:21 AM, Bill Janssen wrote: What's the right way to have another process stop an application? Send it the "quit" Apple event. Nick Zitzmann ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.co

stopping an application

2009-04-12 Thread Bill Janssen
What's the right way to have another process stop an application? Sending a SIGTERM doesn't seem to invoke the application shutdown dance; and signal handlers don't seem to establish themselves. Bill ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.co