Javascript in the program for numbering files

Advanced Renamer forum
#1 : 02/02-16 08:37
Posts: 1
I have a lot of images in folders. I wanted to change their names automatically using the program.
The method is to start numbering from (0) in every folder.
For example:
Folder name: AB-001
File names: AB-001(0), AB-001(1), AB-001(2), etc.

My script is:

for(var counter=0; counter<20; i++) { //there is always less than 20 pictures in folder
return item.newBasename + ' ' + '(' + val + ')';

The problem is that it works constantly through all the files. It should stop in one file and start numbering in the other from the beggining. Using standard options in the program is incorrect because it adds zero (0) to the next file after 9th [<DirName:1>(<Inc NrDir:0>)] .
[AB-001(00), AB-001(01) etc.]

Do you know how to fix it?

02/02-16 08:37