View Full Version : Application launch notification

Jul 15, 2009, 12:25 AM
Forgive the complete noobishness, but I am new to the Mac OS platform (at least from the coding perspective, been a user of a few years now). I need to know if there's any easy way for a program to detect when other apps are launched (i.e. iTunes, Safari, Skype, etc. ). Currently trying to automate some things via python and it's been a bit of adventure in and of itself. I'm hoping to tie this in with other projects later on and said projects would be easier when one script knew when things were launched / killed / quit unexpectedly / etc.

Advice, pointers, other info? Thanks so much in advance.

Jul 15, 2009, 01:24 AM
Hey use NSWorkspace for it in cocoa

NSNotificationCenter *notCenter;
notCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
[notCenter addObserver:self selector:@selector(workspaceDidLaunchApplication:) name:NSWorkspaceDidLaunchApplicationNotification object:nil];

now implement

- (void)workspaceDidLaunchApplication:(NSNotification *)note

above method will get called automatically when application is launched

Hope this will help.