Add random number to filename?

Main discussion forum
Post Reply
Thom
Newbie
Newbie
Posts: 1
Joined: Fri Feb 08, 2013 12:59 pm

Add random number to filename?

Post by Thom »

Hello,

I´ve a question ;)

I have an USB player that not supports an random function and plays the music only in an alphabetic order, not very handy of course. Is it possible that the program add´s an random number in front of the filename?

For example;
Depeche Mode - Just Can't Get Enough.mp3 » [035] Depeche Mode - Just Can't Get Enough.mp3
Depeche Mode - People Are People.mp3 » [050] Depeche Mode - People Are People.mp3


Thx if anyone can help me!

Greets,
Thom

User avatar
jtclipper
Administrator
Administrator
Posts: 770
Joined: Tue Aug 10, 2010 12:04 pm

Re: Add random number to filename?

Post by jtclipper »

There is no random function available in the script engine but I will add a reference to it.
So this will not work until I upload the next beta update, you will have to wait a few days.

Code: Select all

program RenameRnd;
begin
  if not tg_Init then exit; // no rows get out
  Randomize;
  repeat
    tg_setField( 'Rename', '[' + PadLeft( IntToStr(Random(100)), 3, '0' ) + '] ' + tg_getfield('Rename') );
  until not tg_Skip;
end.

Post Reply