Aaron Ash
Aaron Ash

Reputation: 1402

Launch Mac application when iTunes starts without background process (like last.fm)

I would like to start my OSX application when iTunes loads, without having a background process to monitor when iTunes launches. The last.fm client seems to do this; I can find no background process when iTunes is closed, but as soon as it starts the last.fm app opens right along with it. Perhaps it is using some kind of iTunes plugin that can start another process?

It seems to be fairly trivial to do this with a background process, but I'd like to do it without one so my program isn't using system resources.

One option with a background process is to use NSWorkspace's notification center, such as:

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(appDidLaunch:) name:NSWorkspaceDidLaunchApplicationNotification object:nil]

However, this obviously requires a background process. Another option I found was to use ProcessNotif, something like this:

ProcessNotif *x = [[ProcessNotif new] autorelease];
[x setProcessName: @"iTunes"];
[x setTarget: self];
[x setAction: @selector(doStuff)];
[x start];

This is probably even less ideal than the NSWorkspace method, and it too requires a background process.

So, is there some way to launch from iTunes when it launches, no background process required?

Thanks!

Upvotes: 2

Views: 455

Answers (1)

anon
anon

Reputation:

The last.fm client achieves that by installing an iTunes plugin. This plugin gets loaded when iTunes starts and then has a chance to start the last.fm app. To create a plugin you need the iTunes PlugIn SDK available here.

Upvotes: 1

Related Questions