Help with addressing itunes buttons with applescript.
May 28, 2010 9:18 PM   Subscribe

In iTunes 9.1, what is the applescript button number for the "Save Genius Playlist" button?

After a morning of googling, I've found that the following:

set buttonTitles to title of every button of window "iTunes"
if buttonTitles contains "Burn Disc" then
click button 17 of window "iTunes"
click button 16 of window "iTunes"
end if

will create a genius playlist seeded by the currently selected track. Huzzah. Can anyone tell me what button number I should use to save this playlist? Alternatively, how do I display a list of the names of the buttons? I have tried displaying the array (or list, or whatever) in a dialogbox, but applescript gives me nonsense because the buttons are obviously some non-string object, and I don't know how to get the equivalent of, say, "Button.Name".

(I suppose I could trial-and-error this, but I'm a bit scared of deleting everything... it's not like I have a dev environment to mess up...)
posted by pompomtom to Computers & Internet (3 answers total) 1 user marked this as a favorite
Best answer: This should give you the information you need:
set buttonTitles to description of every button of window "iTunes"
return buttonTitles
With the "Burn Disc" button absent, this gives me:
{"", "", "", "previous", "play", "next", "mute", "full volume", 
 "text list view switcher", "grid view switcher", "cover flow view switcher",
 "new playlist", "do not shuffle", "no repeat", "hide artwork", 
 "remote speakers", "genius", "show genius sidebar"}

posted by caaaaaam at 10:30 AM on May 29, 2010

Best answer: If you're going to be doing a lot of iTunes AppleScripting I'd set yourself up a dev environment! It's very easy: hold down option when launching iTunes and it'll ask you for a library. Create a new one, and muck around in there.

(To switch back to production, just restart iTunes while holding down option and select your original library)
posted by bonaldi at 12:22 PM on May 29, 2010

Response by poster: Many thanks to both of you! Looks like I was seeking the impossible, but I have a workaround now (selecting all the tracks and then sending a CMD-N to get a dumb playlist with the songs suggested by genius).

I shall now forge on in my safe new muck-up-able library!
posted by pompomtom at 4:36 PM on May 29, 2010

« Older Up the street without a paddle, or is it 'down'...   |   Article about the Transformation of a Middle... Newer »
This thread is closed to new comments.