Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > obj C: find if app is launched, terminate

obj C: find if app is launched, terminate
Thread Tools
VEGAN
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Aug 27, 2002, 08:08 AM
 
How can I find if another application is running and then terminate it.

in Obj C please,

Thanx
     
stupidFish23
Forum Regular
Join Date: Jan 2002
Location: Hungary
Status: Offline
Reply With Quote
Aug 27, 2002, 09:56 AM
 
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.
nothing is when everything is alright
[email protected] ICQ: 153647416
     
VEGAN  (op)
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Aug 27, 2002, 01:26 PM
 
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
     
Rickster
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Aug 27, 2002, 03:26 PM
 
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.
Rick Roe
icons.cx | weblog
     
VEGAN  (op)
Senior User
Join Date: Jun 2002
Location: UK
Status: Offline
Reply With Quote
Aug 28, 2002, 04:37 AM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:26 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,