tags:

views:

26

answers:

1

I want to display a current track title with Cocoa.

For now I could get the playing title with Scripting Bridge but I don't know how to get it just after a song is changed.

Is there any way I can hook a listener to iTunes without a timer.

Thank you.

+1  A: 

iTunes posts a distributed notification when the track changes. This question contains information about the notification you need to observe for, and you should be able to work out what you need to do from either the Python code in the accepted answer or the Objective-C code that the other answer links to.

Peter Hosey
Thank you so much for your fast reply.
Emmettoc
I tried it and it worked well! Thanks again!!
Emmettoc
Emmettoc: If you've found this answer to be correct, you should accept it as such by clicking on the checkmark, so that future readers of this question can know that at a glance.
Peter Hosey
Thank you for your advice. I checked. I have one more question. Do you know a notification for volume changed? Or should I post another question about it? Thank you.
Emmettoc
Emmettoc: You should post another question about that.
Peter Hosey