How to change the play count number in iTunes

UPDATE: This does not seem to work in Windows 8.  If anyone has an idea how to make this work in Windows 8, let me know.  Tkx.

UPDATE 2: This did NOT work for me in Win8/64bit using iTunes 10.7.  However, since iTunes 11 came out, it works again with no addtl changes.  Can’t explain that.

It’s been awhile since I posted some sort of tech/computer thing on this blog, but when I was using this little tip myself today, I thought I’d share it.  I can’t remember how I happened upon this, but I wanted to pass on the info.

NOTE: This is for Windows.  I have no idea how you’d do this on a Mac.

One thing I’ve noticed about iTunes is that not everything is easily changeable.  For instance the play counts.  There’s been times where I’ve accidentally deleted an album with playcounts, and wanted to get back what I had.  Or I’ve imported a new version of an album, and I wanted to transfer over my playcounts, but you can’t do that in iTunes itself without resorting to playing the track the number of times you want, and shifting the slider bar to the last two seconds so the playcount gets increased.  Those kind of tricks aren’t needed anymore.  Just follow these steps.

Open Notepad and put the following text in it:

Dim iTunesApp, currTrack, newPlayCount
 Dim prompt, title, defaultValue

 Set iTunesApp = WScript.CreateObject("iTunes.Application")
 Set currTrack = iTunesApp.CurrentTrack

 prompt = "New playcount:"
 title = currTrack.Artist & " - " & currTrack.Name
 defaultValue = currTrack.PlayedCount

 newPlayCount = InputBox (prompt, title, defaultValue)

 If IsNumeric(newPlayCount) Then
 If newPlayCount >= 0 Then
 If Len(newPlayCount) > 0 Then
 currTrack.PlayedCount = newPlayCount
 End If
 End If
 End If

Save the file as “SetPlayCount.vbs”, putting it in some easily accessible location.  When you double click on it, a box will pop up, asking you what you want the playcount to be.

One caveat, it only works on one song at a time.  It will be the “selected” song.  Whether it’s playing or not, it will only edit the one track that you have highlighted in iTunes.  If iTunes isn’t running, or you don’t have anything selected (like you just started iTunes), it will error as well.

It’s not perfect, but it is useful if you want to change the playcount of an individual track in iTunes.

48 Replies to “How to change the play count number in iTunes”

  1. it works perfect! thanks for solving my problem!
    Ive been wondering how i can change the play counts for a long time and ill be using this method often!

  2. Nice iTunes vbs trick! I hate having duplicate songs with varying play counts and this is a good way of combining the play counts and deleting one.

  3. not working for me… Error is:

    Line: 8
    Char: 2
    Error: Object required
    Code: 800A01A8
    Source: Microsoft VBScript runtime error

    I’m running Windows 7

  4. Works great, thanks alot, much easier than the other method.
    Would it be possible to edit this file to alter the ‘Last Played’ info?

  5. It only works for me when the song is actually playing. Otherwise it changes the last song played/give an error message.

    Great tool though – had some well played songs which appeared to have their playcount go up 10x, messing up some smart playlists.

  6. Great!! I was tinkering with the iTunes.xml file, modifying playcount but everytime I went back to iTunes, the count never changed and the .xml file reverted. Odd. Searching Google, I came across this tip and it works. THANKS so much!

    I did get the error message like the above posts, but I played the track and then tried the script and that’s when it worked.

  7. Amazing!!! I’ve been looking for this for so many time. THANK YOU!!!!

    For me, the song has to play… only selected won’t do it. Minor detail. ;-)

  8. Oh my gosh. I have been searching for something like this for so long. Thank you so much! Works Perfectly!

  9. This works perfectly, when I update an inferior quality song with a new version I can now keep the recorded play counts. Many thanks!

  10. Thank you so very much! I have a kind of OCD about my play count, and the past few nights, I’ve been falling asleep with music on repeat. I could take away the extra plays quite easily with this. Thanks again!

  11. It works just fine in Windows 8.
    Just use notepad and choose to save the file as ‘All files’ instead of ‘.txt’, and have it saved on the desktop.

  12. Great tip! I had tried changing the xml file but, like JT (June 7) said, no luck there.

    As mentioned by so many others, when I tried simply selecting a song in iTunes I got the error but having a track playing enabled the tool to work its magic.

    I’m notoriously anal about my playcount matching for an entire album. I recently re-ripped one of my CD’s so this was a welcome fix hack! Now I can re-rip the rest of my collection with no regret…

  13. If you are ever in, say, jail and need bail money? E-mail me. I owe ya. P: thankyouthankyouthankyouthankyouthankyou

  14. It says can’t create object name itunes application seems I’m the only one it hasn’t worked for

  15. If you are still having errors with Windows 8 make sure you are running wscript as Administrator. Put the code below at the beginning of the script. At the end of the whole script add a fourth “End If” statement.

    Set WshShell = WScript.CreateObject(“WScript.Shell”)
    If WScript.Arguments.length = 0 Then
    Set ObjShell = CreateObject(“Shell.Application”)
    ObjShell.ShellExecute “wscript.exe”, “””” & _
    WScript.ScriptFullName & “””” &_
    ” RunAsAdministrator”, , “runas”, 1
    Else

  16. As someone that is extremely obsessive with their iTunes library, this helped me out EXTREMELY when I got a new computer and lost my entire iTunes library. Massive thanks!

  17. It’s a really great little programme! Very helpful.

    But ever since I updated to iTunes 11.1.1.11 it doesn’t work anymore :(… I already altered my SetPlayCount with the extra couple of lines Ryan mentioned on January 30th. I still get the following warning:

    It says it can’t find iTunes.Application
    Code: 80020009
    Source: WScript.CreateObject

  18. Thanks so much, does exactly what it says on the tin. Perfect little applet that does something that should be built into iTunes to begin with.

  19. Works absolutely great, just follow the instructions exactly. I made the mistake of creating a new notepad file first, and then trying to save as SetPlayCount.vbs which didn’t work. You have to open NotePad, paste the text in and then save as SetPlayCount.vbs (select “all files” in the “Save as type” drop down.

  20. In addition to my last comment, I actually prefer this code which lets you change the current iTunes track selected, rather than having to change the track that’s currently playing in iTunes. This way, I can listen to my iTunes whilst still editing Play Counts :). See the code below:

    Dim iTunesApp, selectedTracks, newPlayCount
    Dim prompt, title, defaultValue

    Set iTunesApp = WScript.CreateObject(“iTunes.Application”)
    Set selectedTracks = iTunesApp.SelectedTracks

    prompt = “New playcount:”

    For Each IITTrack In selectedTracks
    title = IITTrack.Artist & ” – ” & IITTrack.Name
    defaultValue = IITTrack.PlayedCount
    newPlayCount = InputBox (prompt, title, defaultValue)

    ‘MsgBox(“NewPlayCount = ” & newPlayCount)

    If Len(newPlayCount) > 0 Then
    If IsNumeric(newPlayCount) Then
    If newPlayCount >= 0 Then
    IITTrack.PlayedCount = newPlayCount
    End If
    End If
    Else
    Exit For
    End If
    Next

  21. Love it! Though time consuming I was able to change the play count for over 700 songs. I’m going to play with the code in VB6 and see if I can streamline and accelerate the process in one shot by loading in a text file containing the desired data.

Leave a Reply

Your email address will not be published. Required fields are marked *