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 > Viewing running processes in Cocoa

Viewing running processes in Cocoa
Thread Tools
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 8, 2004, 12:49 PM
 
First off, thanks for helping on the last problem I had!!! It was exactly what I needed.

Here is my next problem. I need to find and view a running process. The process will be run either with a window or in the terminal. I found how to do it in Carbon, but need to use Cocoa. If you can, point me to a website with examples or just let me know the NS call I need. Thanks!!!
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 8, 2004, 12:52 PM
 
Ahh... used my brain this time and found NSProcessInfo on developer.apple.com... Anyways, if you want to let me know if this is right or wrong, go ahead. If you want to make fun of me because I cant think right now, go ahead.
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 8, 2004, 01:43 PM
 
Ok, now I can get the name of the process that I am running, basically the name of the program. How do I get another applciations process name?
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jan 8, 2004, 03:19 PM
 
Any API that works from Carbon will also work from Cocoa... you can use what you found already.

If you'd rather not, well... Foundation and AppKit don't include any process management utilities. The closest you'll get is NSWorkspace's methods for finding out about other GUI applications. But programming with Cocoa doesn't mean you have to use only ObjC APIs... you can use the same BSD system calls the ps and top utilities do. (You can even check out their source code from Darwin if you need help.)
Rick Roe
icons.cx | weblog
     
Banned
Join Date: Apr 2002
Location: -
Status: Offline
Reply With Quote
Jan 8, 2004, 03:48 PM
 
there's a very good wrapper around...
search..
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 8, 2004, 04:36 PM
 
HA HA HA!!! I completely forgot about using ps and top... I will try using NSTask to launch ps or top. Luckily I have done that in C before, so I can do it here. Thanks and if anyone has more suggestions, let me know!
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 8, 2004, 06:28 PM
 
wrapper? I will look for it unless you want to let me know where to look...
     
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Jan 8, 2004, 06:49 PM
 
I had a similar need a while back and performance was absolutely key. I dug up some basic BSD C code and stuck it in my Coca class. if you can get away with using the Cocoa libs then don't bother with this.

The file name was GetPID.c by Chad Jones. I don't remember where I got it from. Google might find it.
iMac 17" G4 800MHZ & 768 SDRAM
     
Banned
Join Date: Apr 2002
Location: -
Status: Offline
Reply With Quote
Jan 8, 2004, 07:06 PM
 
Search for AGProcess

the most complete cocoa wrapper I know..

good luck
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 8, 2004, 07:50 PM
 
Found AGProcess and will check it out in the morning. Thanks! It looks like what I was looking for.
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 9, 2004, 03:06 PM
 
Just wanted to say thanks for the link! I got AGProcess working last night and it works great!
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 11, 2004, 06:44 AM
 
Most of AGProcess' functionality is now implemented by NSWorkspace under the -launchedApplications dictionary, isn't it?

Or does AGProcess also do *nix processes?
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 12, 2004, 10:39 AM
 
AGProcess works with *nix processes. I will look for the NSWorkspace here in about 30 minutes. It works really well when you already know the process id of the applications running
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Jan 12, 2004, 07:19 PM
 
NSWorkspace does not work with unix applications. There is some cool stuff you can do with it though.
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:49 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2