Re: iTunes beat me again!
Re: iTunes beat me again!
- Subject: Re: iTunes beat me again!
- From: Stan Cleveland <email@hidden>
- Date: Wed, 14 Jun 2006 17:23:06 -0700
- Thread-topic: iTunes beat me again!
On 6/14/06 5:03 PM, Andy Ihnatko wrote:
> I'm stumped. Why doesn't this script work?
>
>
> 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_?
You're trying to concatenate a vector (list) and a reference to a playlist,
but iTunes reports that it is unable to coerce the reference into a vector
and the concatenation fails. Try changing this line:
set theSelectedPlaylists to theSelectedPlaylists & thisPlaylist
to this:
set end of theSelectedPlaylists to thisPlaylist
which instead appends the reference to the vector and, incidentally, is
considerably faster to execute.
Stan Cleveland
Color Technology Inc.
Portland, Oregon
"We're going to turn this team around 360 degrees." -- Jason Kidd of the
Dallas Mavericks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden