tell application "iTunes"
set theSelectedPlaylistNames to {"K-SAL Authors On Tour - Live!",
"K-SAL Most Recent 3 Purchases"}
set theSelectedPlaylists to {}
repeat with i from 1 to the number of items in theSelectedPlaylistNames
set thisPlaylist to (the first playlist of source "Library" whose
name is item i of theSelectedPlaylistNames)
set theSelectedPlaylists to theSelectedPlaylists & thisPlaylist
end repeat
end tell
Here's the resulting event log:
tell application "iTunes"
get playlist 1 of source "Library" whose name = "K-SAL Authors On Tour - Live!"
user playlist id 5450 of source id 39
get user playlist id 5450 of source id 39
user playlist id 5450 of source id 39
"Can't make «class cUsP» id 5450 of «class cSrc» id 39 of
application \"iTunes\" into type vector."
It stops with the first iteration of the second statement of the loop.
I use this exact same language in a larger script that adds playlists
to a list and it works just fine. Why does it fail _here_?
(Naturally, this isn't the whole script. It's just the hunk that's
acting up...but this hunk reproduces the problem precisely.)