Auto Number Tracks

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

kriscs1
Posts: 16
Joined: Thu Mar 29, 2007 5:34 pm

Auto Number Tracks

Post by kriscs1 » Sun Apr 01, 2007 7:50 am

Hi, I don't know anything about scripts really but I put this one together to automatically number tracks for each artists.
The problem is that when I select loads of tracks (well only about 100+ or so) the program seems to freeze up. Does anyone know why this is and how to stop it please? (and maybe a way to show it's current progress?)

Code: Select all

Sub AutoTrackNumber
  Dim list, itm, i, tmp
  Set list = SDB.CurrentSongList
  tmp = ""
  number = 0

For i=0 To list.count-1
    Set itm = list.Item(i)

    If itm.ArtistName = tmp Then
        number = number + 1
    Else
        number = 1
    End If
    tmp = itm.ArtistName
    itm.TrackOrder = number
    list.UpdateAll
Next

list.UpdateAll
End Sub
Thank you

RedX
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Post by RedX » Sun Apr 01, 2007 8:19 am

if you just watn to number tracks, why don't you use the biult in "auto increment track #" script under:
Tools->scripts->auto increment track #

just select the songs you want numbered in the correct order

kriscs1
Posts: 16
Joined: Thu Mar 29, 2007 5:34 pm

Post by kriscs1 » Sun Apr 01, 2007 8:40 am

Because the script I've made looks at the artist name for each song and when it comes across a new artist it starts numbering from 1 up to the total number of songs I have for that artist. The inbuilt script however simply numbers the songs from 1 up to the number of songs you have selected, ignoring the artist. My script therefore allows me to (or should allow me to) select my whole library and run the script in one go and not have to select the songs from each artist in turn which will take hours.
Last edited by kriscs1 on Sun Apr 01, 2007 8:42 am, edited 1 time in total.

RedX
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Re: Auto Number Tracks

Post by RedX » Sun Apr 01, 2007 8:42 am

kriscs1 wrote:Hi, I don't know anything about scripts really but I put this one together to automatically number tracks for each artists.
The problem is that when I select loads of tracks (well only about 100+ or so) the program seems to freeze up. Does anyone know why this is and how to stop it please? (and maybe a way to show it's current progress?)

Code: Select all

Sub AutoTrackNumber
  Dim list, itm, i, tmp
  Set list = SDB.CurrentSongList
  tmp = ""
  number = 0

For i=0 To list.count-1
    Set itm = list.Item(i)

    If itm.ArtistName = tmp Then
        number = number + 1
    Else
        number = 1
    End If
    tmp = itm.ArtistName
    itm.TrackOrder = number
    list.UpdateAll
Next

list.UpdateAll
End Sub
Thank you
(deleted code)

Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex » Sun Apr 01, 2007 9:05 am

Hi kriscs1,

I must ask why you want todo this?
Why don't you want to have correct numbering in your albums?
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts

kriscs1
Posts: 16
Joined: Thu Mar 29, 2007 5:34 pm

Post by kriscs1 » Sun Apr 01, 2007 9:12 am

Hi,
Well I don't care for album names so I've renamed all my albums to 'All' so that I can access them easier on my Zen (as before I could have had 5 different albums for 1 artist, all with just one song in). Because I've done this, I now need the songs to have track numbers so that they appear in alphabetical order.

Post Reply