Update playcount manually with this script

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

Tiketti

New member
Joined
May 11, 2004
Messages
66
Points
0
Age
42
Location
Helsinki, Finland
Update playcount/last played manually with these scripts

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:

Code:
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.
 
Last edited:

Der_Wolf

New member
Joined
May 25, 2004
Messages
7
Points
0
Location
Munich, Germany
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

New member
Joined
May 11, 2004
Messages
66
Points
0
Age
42
Location
Helsinki, Finland
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:

Code:
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

New member
Joined
Sep 29, 2003
Messages
160
Points
0
Location
Los Angeles, CA
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

New member
Joined
May 11, 2004
Messages
66
Points
0
Age
42
Location
Helsinki, Finland
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

New member
Joined
Nov 4, 2004
Messages
37
Points
0
Location
Seattle
THANK YOU - THANK YOU!!!

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!
 

Tiketti

New member
Joined
May 11, 2004
Messages
66
Points
0
Age
42
Location
Helsinki, Finland
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

New member
Joined
Jun 14, 2005
Messages
23
Points
0
Tiketti said:
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

New member
Joined
May 11, 2004
Messages
66
Points
0
Age
42
Location
Helsinki, Finland
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.

Code:
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

New member
Joined
Nov 6, 2006
Messages
1
Points
0
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

Moderator
Staff member
Moderator
Joined
Apr 26, 2006
Messages
9,378
Points
38
Location
Arizona
The most likely reason for Library not Registered errors is the iTunes install is not good or complete.
 

evilspoons

New member
Joined
Nov 29, 2005
Messages
16
Points
0
Age
34
Location
Edmonton, AB, Canada
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:
 

joecosby

New member
Joined
Sep 28, 2005
Messages
14
Points
0
Location
Seattle
Website
joecosby.com
Thank you very much for this. I accidentally played my "least-played tracks" and it really bothered me to have the last played date for all of them set wrong. I guess I'm kind a nerd about statistics. :)
 
Top