Search code examples
rubyapplescriptitunesrb-appscript

iTunes 10.6.3 changes AppleScript interface?


I have a simple Ruby script that uses the rb-appscript gem to control iTunes, and now that I've updated to iTunes 10.6.3, it appears to be broken.

Prior to 10.6.3, this piece of code would work as expected to get the currently selected track(s):

Appscript.app('iTunes').selection.get()

Now it produces the following error:

RuntimeError: Unknown property, element or command: 'selection'

Edit: Just confirmed that this is also broken in py-appscript, so it's not isolated to rb-appscript.

Which is weird, because the following piece of actual AppleScript still works:

tell application "iTunes" to get selection

Similar examples such as Appscript.app('Finder').desktop.files.get() still work.

I couldn't find any information that would explain if or why this was changed or what I could do to update my script. I'm guessing it has something to do with Mountain Lion changes.


Solution

  • Looks like iTunes 10.6.3 was release with the sandboxing that is coming with Mountain Lion. Here is an article talking about it (read the comments, too) http://www.leancrew.com/all-this/2012/06/the-first-nail-in-the-coffin-of-python-appscript/

    Probably will start happening much more (if not with everything) as of Mountain Lion