I'm writing a script in iTunes, part of which changes the selected playlist. When I'm all done, I want to restore the playlist and the selected tracks. I was able to do the first, but haven't found a way to do the last (and I'd really rather not use UI scripting and keyboard automation to achieve it). Here's what I've got that's working:
tell application "iTunes"
-- Save the original playlist and selection
set originalPlaylist to view of front window
set originalSelection to selection
-- go on and select some other playlist
delay 5
set view of front window to originalPlaylist
-- something like this, which doesn't work:
-- set selection to originalSelection
end tell
Best Answer
Try: