Application launch notification

Discussion in 'Mac Programming' started by anonxa, Jul 14, 2009.

  1. macrumors newbie

    Joined:
    Jul 14, 2009
    #1
    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.
     
  2. macrumors member

    Joined:
    Jun 17, 2009
    #2
    launch notification

    Hey use NSWorkspace for it in cocoa

    NSNotificationCenter *notCenter;
    notCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
    [notCenter addObserver:self selector:mad: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.
     

Share This Page