1a 1b 2a 2b renaming

Advanced Renamer forum
#1 : 25/01-19 10:02
must
must
Posts: 2
Hi,

Is there any way to rename the files in advanced renamer in this order:

1a, 1b, 2a, 2b, 3a, 3b and on..

(also it doesnt have to start with 1, the number should repeat itself and ends with a and b consecutively)

thanks in advance.


25/01-19 10:02 - edited 25/01-19 10:12
#2 : 25/01-19 17:42
L B
L B
Posts: 46
Reply to #1:

Hmmm... maybe you can modify the example script to incorporate your requirement:

https://www.advancedrenamer.com/user_guide/examp le_scripting


25/01-19 17:42
#3 : 28/01-19 06:09
must
must
Posts: 2
Reply to #2:

thanks for the help, on the other hand I know nothing on scripting to modify.


28/01-19 06:09
#4 : 28/01-19 12:41
David Lee
David Lee
Posts: 106
Reply to #3:
It should be very easy to work out how to modify the example in the User Guide with a minimal amount of online research!

However - as I'm feeling generous...

Declare a variable and initialize to one less than your starting value in the Pre batch script

eg: to start numbering from 1a : var x = 0;

Then in the main script window:

var str = index % 2 ? 'b' : 'a';
if (str =="a") x++;
return x + str;

This will return filenames: 1a, 1b, 2a, 2b, 3a, 3b etc


28/01-19 12:41
#5 : 15/02-19 09:49
_H_
_H_
Posts: 8
Reply to #1:


15/02-19 09:49 - edited 17/02-19 15:49
#6 : 15/02-19 11:45
David Lee
David Lee
Posts: 106
Reply to #5:
Assuming that you intend the batch script to be:

return getCount(index);

the Pre batch script needs to be:

var n = 0, chrs = ['b', 'a'];
function getCount(index){
var i = (index + 1) % 2;
n += i;
return n + chrs[ i ];
}

Otherwise the sequence returned will be: 0b, 1a, 1b 2a, 2b etc


15/02-19 11:45
#7 : 15/02-19 11:50
_H_
_H_
Posts: 8
Reply to #6:


15/02-19 11:50 - edited 17/02-19 15:47
#8 : 15/02-19 12:05
David Lee
David Lee
Posts: 106
Reply to #7:
That, of course, does exactly the same job.

However, without specifying how to use the function your solution would be useless unless the OP is familiar with the use of functions in JavaScript - in which case he wouldn't have needed to ask the question anyway!


15/02-19 12:05