PDA

View Full Version : Update playcount manually with this script


Tiketti
07-22-2004, 06:33 AM
I made a small and simple script to edit a song's playcount. Why, you ask. Sometimes you might listen to low quality song 10 times on your iPod, decide to re-rip it with better quality, and replace the old copy with the new. I personally like to "transfer" the playcount to the new copy of the old song.

Somebody propably has already made something similar to this, but here's my take on it. Feel free to use it and abuse it, it's only a few lines of code.

Here you go:


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


Copy-paste the above text in Notepad and save it as SetPlayCount.vbs.

To use it the script, play the song you want to edit in iTunes, double click the script file, feed new playcount into the inputbox. That's it.

I made the script for my own personal use and have tested it on my own computer. As you can see from the listing, it really shouldn't do anything critical, but I can't guarantee anything.

Hope that makes sense and somebody finds it useful.

Der_Wolf
07-27-2004, 12:50 PM
Thanks for Your fine Script!
It is verry usefull for me and I like it verry much. It works great for me!

Do you know a method to edit the "Date Added"?
If I replace a song with another version I the info for date added changes. I have a playlist "New Songs" with my songs added in the last two months, in which I don't want the modified songs to appear. It would be a graet feature!

Thanks in advance!

Tiketti
08-13-2004, 03:35 AM
Thanks, I'm glad it's of use to you.

Sorry it took me a while to reply. I just tested this and it seems DateAdded is a read-only property. Meaning I can't change it with an iTunes script. Some people have been hacking the iPod database by other means but these iTunes scripts are easier and safer to make.

But, in case anybody is interested, here's a similar script to change the Last Played Date:


Dim iTunesApp, currTrack, newLastPlayed
Dim prompt, title, defaultValue, errorMsg

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

prompt = "Set Last Played as:"
title = currTrack.Artist & " - " & currTrack.Name
errorMsg = "Error in date format"
defaultValue = currTrack.PlayedDate

newLastPlayed = InputBox (prompt, title, defaultValue)
If IsDate(newLastPlayed) Then
currTrack.PlayedDate = newLastPlayed
Else
MsgBox(errorMsg)
End If

b-boy
08-17-2004, 08:39 PM
Is there anywhere on the web where I can find a reference for making my own VBS scripts??? I'd really be interested in trying to make a few of my own!! THANKS!

Tiketti
08-20-2004, 06:23 AM
I haven't found a resource. The way I do it is I use the Object Browser in Visual Studio to see what properties and methods the iTunes object supports.

Rondo1
07-24-2005, 03:36 PM
Thanks much for this. I was getting some really weird things with my playcounts. About 30 songs had numbers like this -1203898

Weird, huh? Even the folks at APPLE Store couldn't help me other than to RESET (and erase) everything on my iPod. I didn't want to do that. Too much risk if you ask me. but your simple little tool is GREAT! Thank you very much!

a1ehouse
07-24-2005, 06:35 PM
COM details for the nerds - http://developer.apple.com/sdk/itunescomsdk.html

Tiketti
08-02-2005, 08:08 AM
Hey no problem. I'm glad you found it useful.

I might tweak it and make the script recognize the tracks selected in iTunes instead of the one playing.

a1ehouse
08-02-2005, 01:50 PM
Originally posted by Tiketti
Hey no problem. I'm glad you found it useful.

I might tweak it and make the script recognize the tracks selected in iTunes instead of the one playing.
Better way to do it Tiketti!

Tiketti
11-02-2006, 11:15 AM
Here we go again with the same old scripts. Except this one I find myself using fairly frequently. Tested with 6.x and 7.0-7.0.2.

This script asks for a new playcount for all songs that have been selected in iTunes. Ctrl-click or shift-click tracks you want to change playcount for and run the script.

Copy this script into Notepad and save it with a .vbs extension. Double-click the file to run. You can also set a global hotkey for the script by making a shortcut to the file, right-clicking it and selecting Properties / Shortcut / Shortcut key.

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

momo1tx
11-05-2006, 03:13 PM
Hello, I am not very good with scripts or anything, and I attempted to use this when I double-clicked it, like you said, and I got the error "Library not registered". Do you have any idea what may have caused this?

cjmnews
11-06-2006, 09:52 AM
The most likely reason for Library not Registered errors is the iTunes install is not good or complete.

evilspoons
05-23-2007, 04:43 AM
I'm happy to report that the script for modifying the selected tracks' playcount works perfectly in iTunes 7.1.1.5. This is exactly what I've been looking for! :cool:

iPodBlanc
08-24-2007, 09:27 AM
Will these work in Windows?

Tiketti
08-24-2007, 12:25 PM
^ These scripts will work only in Windows.

iPodBlanc
08-26-2007, 04:19 PM
edit - nevermind

iPodBlanc
08-28-2007, 06:01 PM
Does anyone have a script for changing the Date Added? Thanks a lot! :)