I am controlling iTunes (on OSX) via AppleScript and would like to know when the user changes things like volume or pauses a song. Any idea how to do that except for polling via AppleScript?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
iTunes sends out a system wide notification so applications can be notified when there’s a change. Cocoa applications can register to receive this notification, but standard applescript can’t. As such your best bet would be to develop your application in Xcode using ApplescriptObjC or objective-c.
FYI: if you get that far the notification is called “com.apple.iTunes.playerInfo” and you get it from the NSDistributedNotificationCenter.
So basically your only option is to poll iTunes from applescript.