Q: Scripting creation of smart playlists in iTunes
Hi,
I am exploring the possibility of scripting the creation of smart playlists in iTunes. As I understand it this can only be achieved with GUI scripting. I have come across a couple of threads which suggest this can be achieved:
https://discussions.apple.com/thread/20 … p;tstart=0
http://macscripter.net/viewtopic.php?id=9967
however both generate an error for me. The problem appears to be around the line "tell scroll area 1 of group 1 of window 1". I get the error:
System Events got an error: Can't get group 1 of window 1 of process "iTunes". Invalid index.
I wonder if someone could help me get this working?
Thanks,
Nick
Macbook Pro, Mac OS X (10.7), 2.66 GHz Intel Core i7 8GB RAM
Posted on May 6, 2012 3:07 AM
well, you see that it's going to be something like this:
tell application "System Events"
tell process "iTunes"
tell window "Smart Playlist"
tell scroll area x
tell group y
tell pop up button z
-- ...
end tell
end tell
end tell
end tell
end tell
end tell
to find out what x, y and z are, hover the mouse over the element and type cmd-F7. This freezes the inspector on that element, and you'll get a new 'Locked on' panel. you can use the 'goto' pulldown menu and the 'highlight' toggle to navigate up and down the GUI hierarchy (go to the parent, check the parent's children, and figure out the index from the order in the list). You could also do it by trial and error, but that can be annoying.
Posted on May 6, 2012 11:37 AM