Working with "every file whose..." and its result

Is there a way to return multiple properties from a “every file whose…” construct? For example, the code below works fine to return a list of names. Is there a way to make the same 1-liner return both the name and the artist?


set myResults to the name of (every file track of playlist "Library" whose name contains searchString or artist contains searchString) as list

Related question: is there a way to tell AS to display a dialog whose content is a list adding a line feed after each list item? For example


display dialog myResults

I know how to do all of the above using repeat loops… just trying to figure out if there is a way to do it all in very few lines.

Try:


set myResults to the {name, artist} of (every file track of playlist "Library" whose name contains searchString or artist contains searchString) as list

or


set {tName, tArtist} to the {name, artist} of (every file track of playlist "Library" whose name contains searchString or artist contains searchString) as list
tell application "iTunes" to set myResults to the {name} of (every file track of playlist "Library" whose name contains searchString or artist contains searchString) as list[/applescript)
set {TID, text item delimiters} to {text item delimiters, return}
set myResults to myResults as text
set text item delimiters to TID
display dialog myResults

Thank you. Seems like there isn’t a way to do it that is substantially shorter than the repeat loop, but the list-return is something I had forgotten about.

Thanks again.