Re: itunes and duplicating track from library
Re: itunes and duplicating track from library
- Subject: Re: itunes and duplicating track from library
- From: Mr Tea <email@hidden>
- Date: Mon, 15 Nov 2004 21:02:35 +0000
This from David A. Cox - dated 15/11/04 5ยท31 pm:
> *****
> tell application "iTunes"
> convert track 1 of playlist "AIFF"
> set fixedtrack to result
> duplicate fixedtrack to playlist "AAC"
> end tell
> *****
>
> but when I run the script, I get an error back of the form:
>
> iTunes got an error: Can't set playlist "AAC" to {file track id 732 of
> library playlist id 40 of source id 39}.
Note that the item 'file track id 732 [etc]' is enclosed within braces,
which makes it a list (of one item). You have to extract the track from the
list to do what you need with it. Also, you should be using 'add' from the
iTunes suite rather than 'duplicate' from the Standard suite to add the
track to the desired playlist. This requires an alias rather than an
internal reference full of ids, but you can get that easily enough by asking
for the location of the track. The following should do what you need...
--*****
tell application "iTunes"
convert track 1 of playlist "AIFF"
set fixedtrack to location of item 1 of result
add fixedtrack to playlist "AAC"
end tell
--*****
Here's a slightly different version that writes the result of the convert
operation to a variable in the same line.
--*****
tell application "iTunes"
convert track 1 of playlist "AIFF" returning fixedtracklist
set fixedtrack to location of item 1 of fixedtracklist
add fixedtrack to playlist "Wake up call"
end tell
--*****
I generally prefer this approach because it grabs the result at the earliest
possible opportunity. I may just be being superstitious though.
HTH
Nick
pp Mr Tea
--
_______________________________________________
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