AppleScripts – Edit your iTunes Play Count
You might ask, why would I ever need to edit the play count of a song? That’s a valid question and this function is probably reserved for the more anal iTunes user but let me give you an example. Sometimes I begin listening to an artist through a ‘Best of’ Album. After a while I realise that I LOVE them and I decide to graduate to their studio albums. Now it annoys me to no end that the songs that I have been listening to on repeat on the Best of albums have no plays on the actual studio albums.
Yes, I’m that pathetic.
If you’re my kinda guy/gal here’s how you add a little script to iTunes to edit the play count of a song. I found the script on the Apple Forums so I thought I would share it here.
Scroll to the bottom if you’re…
** on a Windows machine.
** looking to change the play count of multiple tracks to one value I customised the script.
** using Catalina.
(And… If you want more of this stuff. Head over to Doug – he’s the king of iTunes applescripts. He probably has a script you didn’t know you wanted. He’s active on twitter if you’re the type…)
1. Download the following file:
It should look like this:
2. Now save it in the follow directory:
Users > [User] > Library > iTunes > Scripts (create this folder if it doesn’t already exist)
**The name of the file is what will appear in your iTunes services Menu, I named mine ‘Change Play Count’ as you can see from the file name.
(Untitled is the name of my hard drive and chikaboo is the name of my user)
**If you can’t find your Library folder, when you’re in finder select ‘Go’ in the menu bar and hold down the alt/option key at the same time, it will appear in the list of folders.
3. Ta dah, you will now see the option in the scripts menu of iTunes! Just select a song and type in the number
** WINDOWS UPDATE 21/05/2018
If you’re on a Windows machine, someone contacted me with an application they made: https://github.com/CDEngineer/iTunesDataEditor/releases. Some instructions from the creator:
In a nutshell, you create a playlist with the songs you want to edit, fire this tool, select that playlist and then you have a grid with all the songs, double click the play count and change it, when you press ENTER it is saved to the iTunes library.
Thank you Mistico!
** MULTIPLE TRACKS UPDATE 06/11/2018
Someone requested the the script make it possible for you to select multiple tracks and change their play count value at one go. I have adapted the below script for that purpose. The process for installing it is the same as above.
** CATALINA UPDATE 09/10/2019
Someone has alerted me to the fact that iTunes has been removed in the latest macOS Catalina. I don’t know how I am going to cope with that – I am likely going to wait till my current 2015 Mac has COMPLETELY died before succumbing to this tragedy. Anyway for now I have done some research and I believe the script should still work with a few changes.
1. Download the same script (button below)
2. Open it with the ‘Script Editor’ App and in the first line where it says ‘tell application iTunes’ change iTunes to Music (unfortunately I couldn’t do this for you because I haven’t updated to Catalina yet)
3. Now save/move this file to:
Users > [User] > Library > Music > Scripts (create this folder if it doesn’t already exist)
122 Comments
Join the discussion and tell us your opinion.
Hi Natasha, I tried to add this script but it’s giving me “A command name can’t go after this identifier.” With “played count” in the fourth last line highlighted. Any Help would be appreciated. Thanks!
Hey there!
I have changed the tutorial slightly and included a downloadable file of the script. Here it is: https://www.chikaboo-designs.com/wp-content/uploads/2016/01/Change-Play-Count.zip
Let me know if that works!
That worked perfectly! Thanks for the quick response and all the help. Really appreciate it!
No worries at all. I’m so happy that someone actually wants to change their play count and is reading this article – this is the best thing that’s happened to me all day. Hah. Have a good one!
I’ve been replacing older albums with remastered albums or deluxe editions so it was silly to start from “0” on all the albums I’ve been replacing. This is a great alternative to queuing the song 200x and skipping to the end 200x 🙂 I’m glad I found this post.
This script was a godsend – thanks so much!
I’m glad I could help!.. but mostly I’m glad I am not the only one needing to change my play count!!
Im confused on how to save it in itunes?
Hi Mike,
You should save it in this directory:
Users > [Username] > Library > iTunes > Scripts (create the Scripts folder if it doesn’t already exist)
Does that help?
How do I create the folder to save it to iTunes?
Hi Anthony. You need to create the folder in this directory: Users > [names of your user] > Library > Music > Scripts (create this Script folder if it doesn’t already exist). If you can’t see your Library folder when you’re in Finder. Select ‘Go’ in the menu bar and hold down the option key. Library should then appear in the list of folders to go to. Does this help?
Hello Natasha, I can’t get this scripts to work with Big Sur, I wonder if this has been updated since Catalina. I get the following error; “error “AppleScript Utility got an error: Can’t get selection.” number -1728 from selection”
Hi Terry! I haven’t yet updated it to Big Sur actually. I found this though: https://stackoverflow.com/questions/45313753/new-to-scripting-error-finder-got-an-error-can-t-get-folder. Might it help?
As a person the likes to own and organise my music in the era of Spotify & co I´m so glad to finally find a script like yours.
Thank you very much
Pedro!! You made my day! If you ever want to give me some iTunes tips get in touch!
Thanks, Natasha! This works just as intended on macOS 10.12.6 running iTunes 12.6.2.20. Cheers!
Worked for me too! Exactly what I needed to do. I had someone send me a song or two of an album and liking it a hell of a lot, I decided to buy the official album off iTunes. I deleted my downloaded ones and re-downloaded right off iTunes and had to set up my play count again. I’m definitely one of those “anal” iTunes people haha
I’m so happy to know I’m not the only one who worries about play counts! Always work on it when I have a song in “XXXX 0 single” album and then the actual album is released.
I found this script on the Apple forum as well, but I couldn’t manage to make it work. With your tutorial, there was no way to miss it. Thank you for this! You made my day 🙂
Thank you so much Natasha! iTunes Match managed to screw up one of my favourite albums, and the only way to fix the problem was to reimport the CD – which I expected would mean losing my play count data for these tracks, which would flow on to ruin several smart playlists I have which rely on play count data. Your script saved me 🙂 Once again, thank you so much!
Hi, Thank you for this. Unfortunately after modifying the play count, as soon as iTunes syncs to the cloud it will change it back to it’s original count. I wonder if it’s because I have an Apple Music subscription?
Hi Dave,
That’s really strange. I haven’t experienced any problems like that so I imagine it is because of your Apple Music Subscription. That seems weird thought because you would think your library play count would just be added to the cloud. I will do some googling and see if I come up with anything. I briefly read that it might take some time. Maybe a couple of hours?
Hi Natasha, as soon as iTunes syncs it reverts to the previous count. It’s as if Apple has a ‘the cloud is the truth’ policy. 🙂
Dave, I hate to say it but I think the cloud is slowly trying to ruin and take over our lives… ?
Did you get this to work? I’m having the exact same issue 🙁
I’m so sorry to hear that. I’m gonna look into it and see if I can find any solutions. I don’t have iCloud though so I might struggle… but I’ll do my best.
I know this has been a while.. This seems like an amazing tool! By any chance, do you have a Windows version of this, or know of something similar? I am in a similar boat as you and some of the other posters, in terms of needing to adjust playcounts when Remasters are taken into account. If I have heard every song in the Van Halen album ‘1984’ over 300 times each, it makes no sense for me to start over at 0 if I am updating!
Hi Kevin! I love when people take interest in this blog post, makes me feel less alone in my anal iTunes library sorting. I think the way you’re going to have to do this is by editing your iTunes library xml file (some information on it here: https://support.apple.com/en-gb/HT201610). Open it with notepad or another simple text editor, I don’t remember what the default one is on Windows anymore. Then find the songs and manually change the play count. That’s the only way I could think of. Let me know if it works.
Hello Natasha, I modified the play count in the XML file, but as soon as I started iTunes my changes were overwritten. I seems the XML file is regenerated each time iTunes starts and any updating is uni-directional. Any other ideas? Thanks!
Hey! Are you using a mac? Have you tried saving my apple script? I haven’t changed the play count using the XML file but I can look into it if the script doesn’t work.
Hello, no, I am using Windows 7. Is there a version of the script for Windows? Thanks.
I found this: http://samsoft.org.uk/iTunes/scripts.asp. Was developed a while ago so I wonder if it still works but I would be interested if you managed to get it up and running.
Hello again Natasha, I built a tool to edit the iTunes play-count on Windows (https://github.com/CDEngineer/iTunesDataEditor/releases) Thanks for all your help!
That’s so cool!! Wow. Thank you. How does it work exactly? I am going to put a link to it in the article. Do you want any credits (name/website/anything else..)?
You’re welcome! You should link to https://github.com/CDEngineer/iTunesDataEditor the instructions are there (the /releases page contains only the binaries). In a nutshell, you create a playlist with the songs you want to edit, fire this tool, select that playlist and then you have a grid with all the songs, double click the play count and change it, when you press ENTER it is saved to the iTunes library. Hopefully some one will find this helpful. Thanks again!
Brilliant. You’re in the post now!
Mistico & Natasha, thank you so much for sharing this info. I used the iTunesDataEditor and it’s a life saver, such a big help for managing my music playcounts. Thank you!
Our pleasure 🙂
Natasha, this is amazing! This is exactly what I have needed for a long time to combine play counts for duplicate copies of songs (from different albums/downloads), so I can deduplicate my iTunes library without losing my precious play count data. As you walk around today, no one in person will know that you are an AppleScript angel. But commenters on this page do, and we appreciate you!
You made my day!! It’s really the little things in life hey..?
Thank you so much for this! But there is a problem for me… I saved the script in the folder and there is also an icon of the script in the top bar of iTunes’ window. But when I push the “OK” button in the script plays are not changing at all. I’m getting the feeling i’m still doing something wrong… Can you please help me with this? Would really appreciate it
Thank you in advance!
Hey Andrew. Thanks for getting in touch! I am emailing you directly a zipped file of the script I have installed on my computer. I just double checked that my script still works, and it does. I am running iTunes 12.8.0.150 on my Mac. Let me know what happens.
Thank you SO SO SO much for this! I’m one of those “anal about iTunes” people and recently my most played song of all time got corrupted somehow. The past month or so I’ve just gone without listening to it rather than replace it because I didn’t want the play count to drop down to zero. I’ve also been meaning to upgrade a lot of my music to 320kbps versions so this will come in handy there as well.
[…] iTunes library; turns out there are other music crazies on the internet who’ve gone mad for AppleScripts – Edit your iTunes Play Count. I love the internet, it makes me feel less […]
Omg this is going to save my sanity! Thank you so much for sharing!!!
so happy to help!
Great, thanks very much for making this available. I had an old version of a similar script from another developer that hasn’t worked with the more recent versions of iTunes so I really appreciate your efforts!
my pleasure
Thank you for this script! I have been looking for an easier way to update play counts and this script is the answer! Works great!
I normally don’t leave behind comments but it needs to be said that the ease of the tutorial, not to mention to find a fellow iTunes Nerd, are very much appreciated. Thank you!
That’s so kind!!
Unfortunately, my play counts have returned to their previous number. 🙁
Oh no! Someone did comment that before actually. I think it had something to do with Apple Music. Could it be to do with that for you? Does it return to the previous number immediately?
Oh… I do have Apple Music. It doesn’t change it immediately, sometimes it sticks but it does change on another device I am using and then it will eventually change at one point or another. 🙁
I’m afraid I haven’t yet figure out the solution this problem. I’m sorry about that. There seems to be some way in which Apple Music syncs music that conflicts with manually changing the play count!
Thanks so much for this tip! I was a bit leery at first – but I went ahead and created a Scripts folder where you said. Then I quit iTunes, restarted it, and Presto! there was my little script menu! Now when songs are remastered, and I replace the old version with the new one, last.fm doesn’t think I’ve never listened to it before! Yes … that matters to a geek like me. Thanks again – wonderful feature!
My pleasure 🙂 omg love that you’re concerned about last.fm too!!!
Thanks so much for this! I couldn’t find anything like it on Dougscripts and came up empty, fortunately found it here here, still can’t find it there. I got “This Is The Last Song” there, (love it, wish there were an iOS app for it) and yes, there’s just so much goodness on that site. Best!
Strange! I actually wrote to him once to tell him to link to my site and he said he already had a script on his own. Anyway glad you found what you were looking for.
I does work, it changes the play count but it won’t stay forever. it goes back to the original one after sometime, idont know how. maybe after I reopen iTunes or maybe after it refreshes itself, but the edited play count won’t stay forever. Please help regarding this and Thankyou.
That’s so strange. Are you using Apple Music? If you are, that can sometimes cause problems! Some other people have had a similar problems. I am not sure what the solution is to be honest!
Natasha, you are a GODSEND! I have been wanting to change the play counts for YEARS, as they are crucial to my listening experience, ha ha. I recently had to re-download over 1000 songs, which all have a 0 play count, so it messes up my playlist system. Thank you!!!!
haha I love music/iTunes geeks like you 🙂 So so so so so happy to help.
Hey Natasha, 🙂 Love what you’ve done and love the script, been using it for a long time now. Just updated to MacOS Catalina and sorry if this has been asked already and/or if you’ve already answered this question, but now that iTunes is “gone” and Apple Music is the new official app for Music on the mac, what’s the word on getting this script working for Catalina? Apple Music is basically the same as iTunes with a little flare added to it, but I know nothing about programing or scripting, so was just seeing if there was an ETA on the script. Be happy to help in any way I can. 🙂 Thanks!
Hi there! So glad you’ve been enjoying the script. I did a little research and have added a little update to the end of the post. PLEASE have a go and let me know if it works. I don’t have access to Catalina to try it out myself.
SUCCESS! Thank you so much! I missed a step and didn’t see to make a new “Music” folder, but after I caught that it loaded right up. Just tested it out too and it works just fine. Thanks again!
I’m so pleased to hear that!
Thanks so much! I am running macos Catalina and my iphone has the latest ios. I don’t know where the bug is, but every time I sync my phone, songs that have previously been sync’ed, the play counts get incremented again.
Hi MJ. I’m not sure I understand. What do you mean by the play count gets incremented? You mean when you sync your phone the songs return to the play count they had before you used the script? In my experience, these bugs usually have something to do with Apple Music. Could that be the case for you?
Oh no, problem isn’t your script. It’s a sync issue between my phone and mac. The script works great. Let’s see if I can describe the issue much clearer… Let’s say i played Song A on my phone. After sync’ing the play count of Song A would be X. If I played song B and I sync’ed again , song B’s play count would be X, but song A would have X+1 even though I didn’t play it. If I played song C and sync’ed, song C would have X play count, song B would have X+1 and song A X+2 without playing both song B and song A. I had to use your script to correct the play counts.
Gosh, that’s a complex problem! I have no idea how to help you on that front… I’m so sorry about that!
Thank you for Catalina info, I have been using Add play count -script in iTunes for years and was bit confused when it wasn’t available in the new Music App. I too missed the creation of Music-folder, after that script loaded right away. I rarely leave comments on websites but for this I just had to make an exception, cool to know that I am not alone with this edit playcount obsession 😀
I am so happy to help!! And I feel honoured to have received your comment seeing as you don’t give them out so easily.
If you change the phrase ‘played count’ to ‘skipped count’ you can use a new version of the script to change the skip count as well.
Just in case 🙂
oooh. Thanks for the addition! But may I ask, what is the skip count?
Thanks, this is something I have wanted for years — works perfectly in Catalina too.
So glad to hear it!
Thank you for the script, I managed to change the number of plays on a song but for some reason the song no longer appears in my most listened playlist, even though it should be in the top 20!, do you know if it’s normal ?
Hmm! That is a strange issue. That isn’t normal. Does it definitely have enough plays to be in the top 20? I am not sure what the problem would be… Maybe try putting up the play count to something really crazy big and see if it works then..
please ): it doesn’t work for me anymore ): the icon doesn’t show up
Hi Cinto, are you on OS Catalina? I have a some updated instructions to get the script to work with the new ‘Music’ app. It’s at the bottom of the post.
I don’t think you have to save it in a specific location. I’m on OS Catalina, I just kept it in downloads. To change the play count, I just have to highlight the song I want to change and open the script using script editor. Then all I have to do is click the run button and the script will run perfectly. The only inconvenience is that I have to find it in downloads (which is fine for me) but other than that it works fine. Thanks for the script Natasha!
Ah! That’s really good to know. Thanks Liam. Glad it’s working for you.
This is what’s working for me too. I’m on Catalina, but the Library > Music folder isn’t there, so I put it in Library > iTunes. The script icon didn’t show up. I found this comment and tried this, and it worked. I can even select multiple songs at a time and run the script. It doesn’t batch process, I still have to enter one play count at a time, but it pops them up in sequence, so it’s faster than selecting a tab, cmd-tabbing to the Script Editor, running, changing, and tabbing back to select the next song.
Natasha, I want to thank you for creating useful instructions! There are so many apps and scripts available to do this, but without enough instruction for those of us who don’t use scripts regularly. I’ve been trying to fix my problem (Music just deleted play counts on some songs, even when it showed a “last played” date and time!) for _years_ and your solution and instruction is the only one that has worked.
James! My pleasure. Thanks for feeding back. As always, I’m glad to know that there are still people who are holding on to their digital files like me. Maybe together we can convince someone to bring out an ipod classic type device?!
Does this script have the ability to add or subtract play counts to multiple songs?
For example, if I have a song that was played 5 times, a song that was played 12 times, and a song that was only played once, can I select all of them, add “+1” to the multiple song editor, and have all the songs play counts change to 6, 12, and 2, respectively?
If that is not already feature, would it be possible to add it as one?
Hi Justin! I’m afraid as of now the script doesn’t have that function. I’m sure it’s possible but it’s beyond my knowledge of Apple Scripts. I reckon with some how to guides on Apple Scripts you’d be able to edit the ‘Change Play Count (Multiple) Script’ to do what you want. Sorry I can’t help more!
Thank you for this! I thought I was the only one who cared about this kind of thing ?
Didn’t see the scripts icon at the top of my screen but was able to make it work by 1) highlighting the song in Apple Music 2) opening the script, regardless of where it is saved and 3) pressing the “Run” button on the script. Took me a long time to figure out that step 3 was necessary. Anyway, thanks again for this.
Hi Brice. I am so glad you made it work! And thank god for other people who care about this kind of thing 🙂
it works but when i update icloud music library to see the numbers on my phone, its being deleted :'( i guess its because of apple music, i mean counts are important, they affect streams
Hi Norman. You’re right, I think having apple music affects your play count. I’m afraid I don’t know how to work around that. I don’t have Apple Music myself…
Hi, thanks for this! I have a slightly different thing I wanted to do, namely being able to set the play count for a whole bunch of songs at once, without being asked to confirm it for each one. Using your script as a starting point, I was able to get the following to work (in this version you just enter a play count, and it applies it to every song you’ve got selected in the Music app):
tell application “Music”
set sel to selection
set dialog_answers to display dialog “Enter a new play count for selected tracks” default answer “”
repeat with t in sel
set newcount to text returned of dialog_answers as integer
set played count of t to newcount
end repeat
end tell
Amazing!! Thank you for that update.
Thanks a lot
Just an update in Feb 2021. This works with macOS Big Sur and the current Music app. Your 09/10/2019 update works with one exception. When I opened the script in the script editor, it didn’t say “‘tell application iTunes’ it said “‘tell application Script Editor’. I changed Script Editor to Music, and it worked as stated above otherwise.
Thanks Joe! Strangely when I download the script it says tell application iTunes. I wonder what’s going on. Thanks for flagging though.
Thanks for this! same thing for me when first opening the script.
Apple Music 1.1.3.3 compatibility? You are my kind of people… I’m SO hoping this will work 4 years post original post… I’m on Big Sur and Apple Music 1.1.3.3 and wondering if there’s a likelihood this will work if I follow the Catalina part of the instruction?! Thoughts? anyone else out there try recently?? Thanks so much fellow play-count geeks 😉
Hi Kristen! Haha, we are your people! I have had feedback that it does work on Big Sur. Follow the instructions in the
CATALINA UPDATE 09/10/2019 and then let me know how you get on.
Natasha, I’m in awe! I had a stint in Healthcare IT working with SharePoint before I left my job to be home with my (little) kiddos. You’re making me miss some of the work I got to do there. I’m inspired to learn more about Apple scripts! This WORKED for me. I did have to poke around to figure out that the folder to save your file into was: /Users/[username]/Library/Scripts/Applications/Music – i also wasn’t showing the Scripts menu, so had to turn that on. I’m so pleased with this lovely little bit of scripting! Now I just need to find the time to update the playcounts for 100 or so music files… wish me luck!
I am sooooo glad! GOOD LUCK!!
That is awesome! Been wanting to do this for years!
I’m so glad!
Hi! For some reason when I click on the button to download the file nothing happens. I have no clue why… I’m on macOS Catalina 10.15.17 please help I left a playlist on overnight and now the play count is bothering me so much
Hi Carol! This was also happening to me, I was able to fix it by dragging the download link over to create a new tab instead of just clicking on it. Hope this helps TT
Also I found out I didn’t have a Music file, took me a while that just creating a new folder and calling it Music did the same thing TT thank you so much for this script !!
Natasha, this is so awesome! I didn’t think anyone else cared about the play count the way I do. This has saved me so much time from doing it manually and showed me that Applescript is still very useful. I may look into what else I could do with it. Thank you so much!
No Problem Mike! Always glad to meet other Play Count fanatics. Let me know if you figure out any other uses for the script. I am yet to delve into the world of Apple Scripts thought they look like they could open a whole universe for me.
Hey Natasha, thanks for the script! I came across a bit of an unsual problem—I had no ~/Library/iTunes/ folder! and so I was racking my brain about where to create the /Scripts/ folder. I keep my library on an external drive so that’s probaby why that folder is missing. Solution was just simply creating the ~/Library/iTunes/ folder lol …took me a few minutes! In any case, thanks again, I’ve recently noticed iTunes doesn’t always register play counts—like a few days ago it only registered play counts for half the songs in an album even though I listened to it all… you can imagine the frustration! x)
I feel your frustration RJ. Glad you managed to figure it out.
Hi! I added script to Library > Music > Scripts. The tiny logo showed up but when I click on it it says “Can’t get selection of application AppleScript Utility”. What do I do? I switched from Windows to macOS two days ago so I struggle with every little thing.
See, I should’ve waited a bit before asking. I fixed it, it works. Thank you a lot!
So glad!
Thank you! I’m still using Mojave (still not sure about the whole iTunes -> Music transition), and this is exactly what I needed. I pre-ordered an album that came with instant grat tracks, and when I put the entire new album in my library I needed to update the play counts of the tracks that I’ve been playing. Occasionally a friend and I will compare our listens for, say, 1990 songs and compare what tracks are currently in our top 10. Thanks again!
Thanks for sharing! So glad it worked for you.
Love this! However I have Apple Music and home sharing set up- is anyone else noticing that the play count reverts back to what it used to be once the sync occurs? I have the new version (Ventura 13.3.1) – has anyone found a solution for this?
I’ve just used this code to correct a couple of outliers (over 1,800 plays each). It worked swiftly. Thank you so much for sharing, and kudos!
It may be worth mentioning that I use Ventura 13.0 and Music 1.3.0.138. The only modification I had to make to the script was on the first line (tell application “Music”).
Your 7 year old post is still saving lives! Thank you!
does anyone know if is it still working in the Apple Music App? I can’t install back iTunes 🙁
I think it is Liz. I’ve used it.
This is amazing, thank you!!!!!
it works but reverts back in a few minutes. anyone has the solution?
Oooh. I haven’t come across that before. Sorry I’m not sure about the fix.