New script: Change track# format to <disc#><trk#

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am

Re: New script: Change track# format to <disc#><trk#

Post by skywalka »

roylayer wrote:I really dislike albums tagged like "Yessongs (disc 1)" and "Yessongs (disc 2)." It's really all one album! Using that scheme, the tracks are usually labeled 1-n within each disc.

I prefer having one album entry per album and giving each track a unique number. 1-n would be fine, but an alternative that is especially useful if track numbers already exist under the "disc n" philosophy is to label them with a <disc#><trk#> scheme. Thus, disc 1, trk 3 becomes track# 103. I have developed a script to do this. (My first script! Yay!) Here it is:

FILENAME: FixTrkNo.vbs

'changes track# from format t to dtt (e.g. disc 1, trk 3 becomes track# 103)
'where t = trk# and d = disc#
'only works for track#s 99 or less

Option Explicit

Sub FixTrkNo
'Define variables
Dim list, itm, i, tmp, discno

discno = inputbox("Enter disc number")

'Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If

'Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)

if itm.trackorder < 10 then
itm.TrackOrder = discno & "0" & itm.TrackOrder
else
itm.TrackOrder = discno & itm.TrackOrder
end if

'Update the changes in DB
itm.UpdateDB
Next
End Sub

ADD THIS ENTRY TO YOUR SCRIPTS.INI FILE:

[FixTrkNo]
FileName=FixTrkNo.vbs
ProcName=FixTrkNo
Order=2
DisplayName=&Format Track# to dnn
Description=Change Track# to disc number + track#
Language=VBScript
ScriptType=0

To use, highlight the tracks you want to change, then execute the script. It will ask you which disc# you want and will then do the rename.
Loving this script.

Thanx heaps.
skywalka
Posts: 97
Joined: Fri Oct 18, 2013 4:13 am

Re: New script: Change track# format to <disc#><trk#

Post by skywalka »

Had to reinstall Windows & spent hours looking for this again. It's very handy & shouldn't only be found buried away in the forum.
Post Reply