Hi technomorph.
We seem to have strayed a long way from the topic of this thread — and even from the items-of-a-class-from-a-list digression.
If ‘aList’ is a list, then 1a and 1b are both wrong because lists don’t have labelled properties. If ‘dsub’ is a property of a record which is the ‘d’ property of aList’s third record, then 1c is wrong and 1d is right.
You’d normally only use an expression like ‘aList’s third record’ where the list contained items of various classes and you specifically wanted the third record. If you know that the list only contains records, then ‘aList’s third item’ may be more convenient. It’s also theoretically more efficient, since it simply grabs the third item from the list without having to check the item’s class.
Yes. BITRATE is a property of the record which is item 1’s INFO value, not a direct property of item 1 itself.
Whichever you find more convenient at the time. Theoretically, if you need to extract several values from a subitem, it’s more efficient to use a variable, as in 3b, since it reduces the number of pointers which have to be followed with each individual value. But the difference is tiny.
It may be possible in ASObjC, but filtering is straying even further off-topic here.
If you know that a record heirarchy contains all the properties of interest, a convenient way to set variables to all the required values would be like this:
-- For this demo, aList is a list containing one record.
set aList to {{INFO:{BITRATE:"128000", GENRE:"Alternative", COMMENT:"missing 20180401", RATING:"Search In Playlists", PLAYTIME:"353", IMPORT_DATE:"2018/4/29", FLAGS:"10", FILESIZE:"5582", |color|:"1"}, PRIMARYKEY:{|key|:"Tekno/:Users/:kerry/:Music/:iTunes/:iTunes Media/:Music/:LCD Soundsystem/:All My Friends - EP/:All My Friends (Franz Ferdinand Version).m4p"}, LOCATION:{DIR:"/:Users/:kerry/:Music/:iTunes/:iTunes Media/:Music/:LCD Soundsystem/:All My Friends - EP/:", |file|:"All My Friends (Franz Ferdinand Version).m4p", VOLUME:"Tekno", VOLUMEID:"Tekno"}, MAININFO:{MODIFIED_DATE:"2018/5/9", MODIFIED_TIME:"47417", AUDIO_ID:"AQoAABEBERERIhEQEiERERFERlVCIjVnQxRWZCIiNVZ1QhETZlUiRVIRNENoQUVVImdlQgJWZiRTEQAWd4UVZ2QQJnZhRUIRERIiEREiEREQABJmRTMhERVYUhFFVUERJERERCJHVFVSE0VCEUZkiDFFZRJmZVITVWUTQyIRFXd1E1Z2MRWGcyVEIiM0M0MyIUdlQQFGZSFGMzEAATITZldBJWVlM0dVd2dnQyIREyIzIiMiISERERA2ZUEmZlUgNWZhRUERAEd4ckZmYxFnZyJFQ0RmdUIRIiIhBHYlVVQzIhEjMjIjMzIiMzIhERERFDERElQxERNDMxACMyERAA==", title:"Test Title 02", ARTIST:"Test Artist 02"}, ENTRYNO:1}}
-- Set variables to the required values from the first record in the list.
-- The record containing the variables must have the same structure as the record containing the values, but need only contain the required properties.
-- The order in which the records' properties are written in the source code is of course immaterial.
set {INFO:{BITRATE:theBitRate, GENRE:theGenre, COMMENT:theComment, RATING:theRating, FLAGS:theFlags}, LOCATION:{VOLUME:theVolume, DIR:theDirectory, |file|:theFile}} to item 1 of aList
return {theBitRate, theGenre, theComment, theRating, theFlags, theVolume, theDirectory, theFile}
--> {"128000", "Alternative", "missing 20180401", "Search In Playlists", "10", "Tekno", "/:Users/:kerry/:Music/:iTunes/:iTunes Media/:Music/:LCD Soundsystem/:All My Friends - EP/:", "All My Friends (Franz Ferdinand Version).m4p"}