Hi,
Say you use a label like “track number”. You could get the value of this property of a track with ‘run script’. Something like this:
set track_name to “Twain”
set the_property to “track number”
set the_script to “on run p” & return & ¬
“return track number of (item 1 of p)” & return & ¬
“end run”
tell application “iTunes”
set the_pl to first playlist whose name is track_name
set t to first track of the_pl
set track_number to (run script the_script with parameters t)
end tell
Similarly, you could set the property in this manner.
So, you would store labels as strings. Like:
{“track number”, “album”, “artist” …}
and you properties for “track number” might look like this:
{1,2,3,4,1,2,1,2,3,4,5,6 …}
Your overall database of properties might look like this:
{{1,2,3,4,1,2,1,2,3,4,5,6 …}, {“album1”,“album2”, “album3”}, {“artist1”, …}}
To get an item from this database you can just repeat through the label list and find the index.
set label_list to {“track number”, “album”, “artist”}
set this_label to “album”
if this_label is not in label_list then return 0
set c to count label_list
repeat with i from 1 to c
set this_item to item i of label_list
if this_item is this_label then
beep 3
exit repeat
end if
end repeat
return i
Since there are only a limited number of track properties this shouldn’t be too slow, but there are other methods of getting an index of a list item.
Instead of saving your labels in a list, you could store it in a string:
set label_table to "track number album artist "
To get the index of the label “artist”, something like this:
set the_table to "track number album artist "
set o to offset of "artist " in the_table
set r to (o div 10) + 1
Here, the table fields have length 10.
gl,