• 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: Detecting a new application launch?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting a new application launch?


  • Subject: Re: Detecting a new application launch?
  • From: Chaz McGarvey <email@hidden>
  • Date: Sat, 10 Jan 2004 20:09:40 -0700

Hey:

On Jan 10, 2004, at 4:24 PM, Colin Cornaby wrote:
I was wondering if there was any sort of notification when a new application launches. I am interested in keeping track of application launches in my program and examining the process (so I need the process id of the launched application) prior to it completing launch.

Check out NSWorkspace. There is a notification called NSWorkspaceDidLaunchApplicationNotification. With the notification comes a dictionary which can be used to look up things about the application which launched. The @"NSApplicationName" and @"NSApplicationProcessIdentifier" and should be of interest to you (read the docs for more info).

One "gotcha." This will only work for applications with a graphical interface. For example, processes which run in the terminal aren't dealt with by NSWorkspace. Other than that observation, I'm not sure what specific qualities define whether a process qualifies to be picked up by NSWorkspace.

Chaz McGarvey
http://www.brokenzipper.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Detecting a new application launch?
      • From: Colin Cornaby <email@hidden>
References: 
 >Detecting a new application launch? (From: Colin Cornaby <email@hidden>)

  • Prev by Date: NSString's stringWithFormat
  • Next by Date: Re: Detecting a new application launch?
  • Previous by thread: Detecting a new application launch?
  • Next by thread: Re: Detecting a new application launch?
  • Index(es):
    • Date
    • Thread