iTunes and rev

Scott Rossi scott at tactilemedia.com
Thu Jul 29 13:30:45 EDT 2004


Recently, "Yves COPPE" wrote:

>> The following function should work (you'll have to parse the results by
>> item).
>> 
>>  function getTracks
>>   put quote & "library" & quote into L
>>   put \
>>       "tell application"&& quote & "iTunes" & quote & cr &\
>>       "get name of every track of playlist" && L & cr &\
>>       "end tell" into s
>>   do s as AppleScript
>>   put the result into tList
>>   return tList
>>  end getTracks
 
> Thank for the script but
> 
> 1° My OS X system is in French and I have to replace "library" with"
> bibliothèque" otherwise I get an "execution error"
> 2° I get the list of the songs, separeted with commas, and I'd like the
> first 2 columns, something like : the title <tab> the artist <comma>

1) I assume that your "bibliothèque" library is the first library in iTunes,
so you should be able to do this:

 "get name of every track of playlist 1"

2) I don't know if there's a way to get multiple properties of all tracks.
AppleScript is very finicky and IMO not as intuitive as a talk language.
But you could get the name and artist properties and combine them into a
single list.  To get a list of artists, use the above function and replace
"track" with "artist":

  function getArtists
   put \
       "tell application" && quote & "iTunes" & quote & cr &\
       "get artist of every track of playlist 1" cr &\
       "end tell" into s
   do s as AppleScript
   put the result into tList
   return tList
  end getArtists

Once you have the two lists of data, combine them into a single list.
Another option would be use a repeat loop to grab each track, one at a time,
and get its properties, but I think this is very inefficient.  Better to
grab everything in two calls and parse/assemble them in Rev.

This kind of stuff will be a little easier with our library. :-)

Regards,

Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list