looking for a script

Advanced Renamer forum
#1 : 12/04-19 02:03
brendan
brendan
Posts: 1
so I need a script for something very oddly specific...

Is it possible to make a script that allows you to reassign numbers in file names randomly without deviating from the number range?

Here's an example of what I want:
so we have three files: picture 1.jpg, picture 2.jpg, and picture 3.jpg. The script that I'm looking for would these numbers jump between each of them, so picture 1.jpg becomes picture 3.jpg or picture 2.jpg.

It's fine if there's a script which just swaps the names instead of the numbers exists, but I require it be random.
(I'm trying to scramble a spritesheet for a game)


12/04-19 02:03
#2 : 12/04-19 07:47
Styb
Styb
Posts: 5


12/04-19 07:47
#3 : 12/04-19 09:00
David Lee
David Lee
Posts: 164
Reply to #1:

You can use app.parseTags("<Num Items>") in the pre batch script to return the number of items in the list.

Pre batch script:

var num = app.parseTags("<Num Items>")
var test = [0];
for (n = 0; n < num; n++) {
test[n] = 0;
}

Main script:

do {
x = Math.floor(Math.random() * num);
}
while (test[x] == 1);
test[x] = 1;
return "picture " + (x + 1);


12/04-19 09:00