Increment with certain numbers skipped

Advanced Renamer forum
#1 : 26/04-22 20:04
Posts: 2

I have a seamingly simple requirement but can't solve it. Need help.
I need to add a simple number increment to multiple files (i.e. 001,002,003 etc)
but being able to tell the renamer which numbers should be skipped while incrementing.
So I might need following incrementing:
001, 002, 003, 005, 006, 007, 009

Here 004 and 008 are skiped.

Is this possible and how?

Any help is much appreciated!

26/04-22 20:04
#2 : 26/04-22 22:06
David Lee
David Lee
Posts: 1125
You will need to use a script method.
(See d_script)

Define a variable in the pre-batch script and initialize it to zero.

Then, in the main script, increment the variable by one.
If the result matches one of the numbers that you wish to skip then increment it again.
Finally adjust the zero-padding and append the number to the filename in the return statement...

Pre-batch script:
inc = 0;

Main script:
if (inc == 4) inc++;
if (inc == 8) inc++;
return item.newBasename + ('00' + inc).slice(-3);

Edit existing or add new "if" statements as required

The UserGuide only gives very basic information - for more information Google "javascript".
I find that hits from are usually most helpful.

26/04-22 22:06 - edited 26/04-22 22:12
#3 : 27/04-22 07:46
Posts: 2
Reply to #2:
This should do the trick. Thank you for a detailed answer

27/04-22 07:46