Posted by Neil Crosby on June 28, 2006 08:30 PM
Is it possible to listen for events generated by iTunes running on OS X? When iTunes is running on Windows it is possible to listen for, say, “OnPlayerPlayEvent” - an event which is fired every time a song starts playing.
More than a year ago now, when I wrote “Using the iTunes COM Interface with Java and Swing”, I talked about being able to listen for these events under Windows. At the time someone asked if it was possible to do the same thing under OS X, to which I glibly replied “sure, use AppleScript”. Of course, I’d never actually used AppleScript myself at that point. Fast forward to last week, when I decided to have a look at listening to events under OS X. Bummer - no listening for events anywhere to be found. I’ve done a bit of Googling, and there are a few other reports of confused people like me not being able to find out how to listen for events.
So, does anyone out there know if it’s possible to do what I want under OS X? If it’s not, the little application I’m writing is going to have to keep polling iTunes to see what its current status is - hardly ideal.
It just doesn’t seem right that the Windows port of iTunes has better programmer connectivity than the original OS X application.
If you really enjoyed what you just read, why not buy yourself something from Amazon? You get something nice for yourself, and I get a little bit of commission to pay for servers and the like. Everyone's a winner!