|
|
obj C: find if app is launched, terminate
|
|
|
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
How can I find if another application is running and then terminate it.
in Obj C please,
Thanx
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Jan 2002
Location: Hungary
Status:
Offline
|
|
Hi!
I think I saw related info in the release notes of the April 2002 developer tools beta. there are some new cocoa functions to find a running application and to kill it as well.
Hope it helps.
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
Originally posted by stupidFish23:
Hi!
I think I saw related info in the release notes of the April 2002 developer tools beta. there are some new cocoa functions to find a running application and to kill it as well.
Hope it helps.
If you were just a little bit more specific it might even help me
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
In Jaguar, there's a new method on NSWorkspace for getting all the active applications. (If you need 10.1 compatibility, you'll have to use the Carbon Process Manager.) However, you'll have to look outside the AppKit and Foundation frameworks for how to kill the app.
If you want to quit it nicely, send an AppleEvent. Probably the easiest way to do that (if you're on Jaguar) is to use the new NSAppleScript class: create a script 'tell application "AppName" to quit' and run it.
If you want to force the app to quit, use the BSD kill function. Type 'man 2 kill' in the terminal for details.
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Jun 2002
Location: UK
Status:
Offline
|
|
Originally posted by Rickster:
In Jaguar, there's a new method on NSWorkspace for getting all the active applications. (If you need 10.1 compatibility, you'll have to use the Carbon Process Manager.) However, you'll have to look outside the AppKit and Foundation frameworks for how to kill the app.
If you want to quit it nicely, send an AppleEvent. Probably the easiest way to do that (if you're on Jaguar) is to use the new NSAppleScript class: create a script 'tell application "AppName" to quit' and run it.
If you want to force the app to quit, use the BSD kill function. Type 'man 2 kill' in the terminal for details.
The problem is I'm trying to write an app for Shaguar, but I don't have Shaguar myself. Grrrr!
Thanks, the NSWorkspace and NSAppleScript sound interesting.
I'm trying at the moment to do it with NSTask using "ps" but it's like 3 pages long when in unix it would just take one line... Grrrr, and more grrrr!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|