Thanks in advance for your help. I am definitely an Applescript rookie and have managed to get as far as I have with the script below through lots of trial and error (and about 6 hours). I'm sure there is a more elegant way to do this!
I'm trying to write a script that consolidates the played count of duplicates in a playlist to a single track then resets the played count of the others to null. I have the meat of the script working, but only for a single track name. What I'd like to do is get a list of all of the track names in the playlist based on properties in comment (contains "already rated). I've tried:
which is fine, but how can I convert that database ID to the track name for use in something like:
where "Behind Blue Eyes" would be replaced with the variable of the conversion of the database ID to track name
Below is the full script that works when I'm able to specify the track name. I'd like to be able to wrap this in a repeat with to loop through all of the tracks in the playlist.
I'm trying to write a script that consolidates the played count of duplicates in a playlist to a single track then resets the played count of the others to null. I have the meat of the script working, but only for a single track name. What I'd like to do is get a list of all of the track names in the playlist based on properties in comment (contains "already rated). I've tried:
Code:
set my_tracklist to (get database ID of every track of playlist "Dupes"
whose comment contains "already rated")
which is fine, but how can I convert that database ID to the track name for use in something like:
Code:
set myCounter to get database ID of (every track of playlist "Dupes"
whose name is "Behind Blue Eyes" and comment does not contain "already rated"
where "Behind Blue Eyes" would be replaced with the variable of the conversion of the database ID to track name
Below is the full script that works when I'm able to specify the track name. I'd like to be able to wrap this in a repeat with to loop through all of the tracks in the playlist.
Code:
tell application "iTunes"
-- myCounter is the track used to maintain the played count for duplicates
set myCounter to get database ID of (every track of playlist "Dupes" whose name is "Behind Blue Eyes" and comment does not contain "already rated")
set myCounter to (myCounter as integer)
set upDateMe to get played count of (every track whose database ID is myCounter)
-- noCounter is the tracks that are going to be added to myCounter then reset to null
set noCounter to get database ID of (every track of playlist "Dupes" whose name is "Behind Blue Eyes" and comment contains "already rated")
set my_list to noCounter
repeat with my_item in my_list
set temp to get (played count of every track whose database ID is my_item)
-- display dialog "temp is now " & temp
set temp1 to upDateMe + temp
set upDateMe to temp1
set (played count of every track whose database ID is my_item) to ""
end repeat
set (played count of every track whose database ID is myCounter) to upDateMe
end tell