6

I use iTunes Match to access my iTunes library at work. I added some new music to my library (back at home) recently, but I forgot to run the "Update iTunes Match" command to ensure that the songs were matched/uploaded to the cloud. Now I'm at work, and my new tunes aren't in iCloud.

I have shell access to my iMac at home using SSH. How can I tell iTunes to update my library from the command line? (I presume the answer will involve the use of osascript.)

A side benefit of knowing this would be that I can schedule it to run nightly so this doesn't happen again, which is why I'd rather not just use VNC.

  • 1
    I usually ssh in and install / start VNC software and set up an ssh tunnel to get around the issue. I hope someone has a better solution than "hacking the rules" Your point about scripting it is great for not relaxing the criteria to do it all from the command line. – bmike Mar 13 '12 at 16:17
4

iTunes doesn't let you AppleScript this natively, but you can use some UI scripting to 'click' the menu bar item and do it for you:

tell application "iTunes" to activate
tell application "System Events"
    tell application process "iTunes"
        click menu item "Update iTunes Match" of menu 1 of menu bar item "Store" of menu bar 1
    end tell
end tell

You can use that via SSH:

osascript -e 'tell application "iTunes" to activate' -e 'tell application "System Events"' -e 'tell application process "iTunes"' -e 'click menu item "Update iTunes Match" of menu 1 of menu bar item "Store" of menu bar 1' -e 'end tell' -e 'end tell'
  • Sadly I haven't figured it out either, but when I run this bit of acript I get: 103:192: execution error: System Events got an error: osascript is not allowed assistive access. (-1719) or 103:192: execution error: An error of type -10810 has occurred. (-10810) when I run it under sudo. – SidMuchRock Dec 17 '13 at 2:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .