I am trying change the names of tracks that are selected and having problems when the tracks get renamed and the sort order changes.
in pseudo script, here’s roughly what I am doing:
set newTrackNameList to {“cool song 1”,“not so cool song 2”…}
tell itunes
repeat with thisTrack in selection
set name of thisTrack to item x of newTrackNameList
end
end
The problem is as soon as the song name changes it’s sort order, the script starts renaming the wrong tracks.
I think what I am looking for is something like this, but I don’t understand the iTunes data types well enough.
again in pseudoscript:
tell itunes
set renameTracks to database id of every selection (get absolute references to tracks)
repeat with x in renameTracks
set name of track with database id to item x of newTrackNameList
end
Is this clear? Basically I want to get an absolute list of tracks that doesn’t change even if their name changes, and rename those tracks based on the selection order BEFORE I rename them.
I’ve looked through many examples and can’t find one that renames tracks this way. There is an example Rename Tracks to Files, but since the files I am using are imported, the default name is already the filename, so that doesn’t help.