Random File Selector

Not directly Renoise related but if I remember correctly one of the members here created a little program quite some time ago that would randomly select a number of files from a directory (and sub-directories?) and copy & paste into a selected location. I believe the main idea behind it was for creating sample packs for competitions.

Anybody know what I’m talking about and where I could find it?

The script is called “rndpack” in the right top combobox.

Cheers mate.

They are your scripts, right? Would it be OK to request reading and taking files from sub-directories and remembering of current path when changing in/out path?

Will understand if you’re too busy or feel it’s too dead in the water to bother.

No, those scripts aren’t mine. The whole project is a collaborative effort from a few members. I’ve only written the windows frontend, not any scripts. In case of “rndpack” the original version was written by Bytesmasher and Conner ported it to PHP later.

it seems like the script can already do that, there’s just no GUI option to set the -r(ecursive) thing. this should be trivial for someone who knows what they’re doing, all the prerequisites are already in the code… I tried adding option for it (recursive yes/no) at the end of the .cfg file, but then it got used as output folder :unsure:

So I see. Also see you can preserve filenames, which I would also like.

Who knows how I would add options to the GUI or chance what the defaults are? Afraid I haven’t done any type of programming (except the most basic HTML/CSS) in 7 or 8 years though…

look at scriptname.cfg

I added

label('Recursive?'); options(true, def:false);  

to the end of the last line, and I assumed two small changes to the “// Check User Input” section of the script would suffice:

and adding after that

$r = $argv[4];  

but alas, that doesn’t work like I expected, because then it complains that true (or false) is not a valid output folder (maybe the arguments in reverse order or something?)

Changed the defaults in the .php file and seems to have worked and that will do me :)

// Recursive
$r = false;
if ($key = _getKey(’-r’)) {
$r = true;

// Preserve filenames
$p = false;
if ($key = _getKey(’-p’)) {
$p = true;

Change False to True in both those cases.

Would a -r and -p now toggle to other method if I was working from command line? Not that I even know what I need to run php scripts from command line…

Open “scripts\rndpack.cfg” and replace the last line with:

gui=label('Options:'); text(-r); text(-p); label('Number of Samples:'); text(100); label('Output Path:'); folder; label('Input Path:'); folder;  

Also delete the “lastused.ini” in the “xrns-sf” folder.

Normally the script could make use of optional parameters using a single textbox, but for this to work one would need to modify the parameter checking in the script itself to accept this. The above is just a workaround for now. Something like below would be better of course but needs a fix in the PHP code to split the “-R” and “-P” properly.

gui=label('Options:'); text(-r -p); label('Number of Samples:'); text(100); label('Output Path:'); folder; label('Input Path:'); folder;  

@Johann: Since the script is expecting the options before the other values, you’ll have to add them in front too in the GUI declaration.

Cheers Beatslaughter. Think I’m unlikely to want to change the defaults often so OK with having edited the .php but I may try and do it more “correctly” and some point and add the option for each variable in the future…