Hi, never been good with AS, but recently bought the excellent Script Debugger from LNS because it’s awesome and actually gets me ahead
I can slowly figure out how to phrase something in AS to get to what I need.
However, now I am stuck:
This is probably rather a general AS question, because it has to do with the ways how to go down a path of objects.
Here is the situation particular to iTunes: I am trying to get a reference to a track that apears only in any of a particular set of playlists. Those playlists are one of the ones “whose special kind is not equal to none”
I know that any track I want to deal with will be in one of those playlists but i do not know in which one. The track class does not offer a property listing the playlist it appears in, so i need to search it.
The two parts I know how to write are:
- track whose database id is equal to X
- playlists whose special kind is not equal to none
Now I just like the first occurance of the track in any of those playlists.
Note: I realize that I could actually write a loop in which I search each playlist for the track but I like to learn if AS has a grammar for selecting the item in one phrase.
Actually, this is my current solution with a loop:
on revealItemByPersistentID(pid) tell application "iTunes" repeat with pl in user playlists tell pl try reveal (first file track whose persistent ID is pid) return "ok" end try end tell end repeat end tell end revealItemByPersistentID
(Actually, there’s another problem: When I replace “user playlists” with “(user playlists whose special kind is not equal to none)”, then I get a quite inspecific “component” error. What’s up with that?