0

After updating my iTunes library to iCloud, the play count of some has been messed up. I was thinking of fixing the missing data by using an Apple Script loop.

The loop should scan the playcount of the current iTunes Library file and replace that of an old iTunes Library file. If I just replace the old file, iCloud Music Library will be disabled.

How do I write such a loop using Apple Script?

var metadata = "/Users/evenwerk/Music/iTunes/Previous iTunes Libraries/iTunes Library 2015-07-07.itl"
var count = 0

tell application "iTunes"
    activate
while count < metadata.count {
      set played count of track named metadata[count].name to 
metadata[count].playcount
count ++
    }
      return
    end tell
  • You might have to loop through each track, sort some track info like title, artist, album, play count, and then loop again to look up and then add. Best might be to save it to MySQL. – empedocle Jul 10 '15 at 16:40
  • 1
    Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. – grg Jul 10 '15 at 16:44
  • I have added some code to my question. – evenwerk Jul 11 '15 at 15:09

You must log in to answer this question.

Browse other questions tagged .