• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: itunes and duplicating track from library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: itunes and duplicating track from library
      • From: "David A. Cox" <email@hidden>
    • Re: itunes and duplicating track from library [erratum]
      • From: Mr Tea <email@hidden>
References: 
 >itunes and duplicating track from library (From: "David A. Cox" <email@hidden>)

  • Prev by Date: Re: Replace text on spesific page
  • Next by Date: Re: itunes and duplicating track from library [erratum]
  • Previous by thread: itunes and duplicating track from library
  • Next by thread: Re: itunes and duplicating track from library [erratum]
  • Index(es):
    • Date
    • Thread