On Mar 25, 2012, at 12:13 PM, Luther Fuller wrote:
I think the info you need is in the 'Tracks' dictionary/record. You can read this into AppleScript using "System Events", but you have to use the Xml Suite, not the not the Property List Suite. Somewhere I have the code to read 'Tracks' into a record, but I don't remember where it is at the moment.
I was curious about this, so I tried something. You can read an .xml file as if it were a .plist file, but ... 'Tracks' has a record of records structure which, at first seemed impossible get at. I finally got a small test script to work. Here it is ...
property trackFile : alias "OS_X:Users:lutherfuller:Music:iTunes:iTunes Music Library.xml"
tell application "System Events" value of property list item "Tracks" of property list file (trackFile as text) set itemCount to (count records of the result)
set trackList to {} set itemIndex to 0 repeat -- 100 times -- be careful ! set itemIndex to (1 + itemIndex) as text try set trackItem to value of property list item itemIndex of property list item "Tracks" of property list file (trackFile as text) set trackList to (trackList & {trackItem}) log ((|track id| of trackItem) as text) end try if (count items of trackList) ≥ itemCount then exit repeat end repeat end tell beep delay 1
Have fun digging out the info you need!
|