Script - adding Incremental Numbers
I want to add incremental numbers (001) to the end of the bunch files.
Currently I use:
return str + item.index;
I need to start from 1, but the .index is starting from 0:
0
Currently I use:
return str + item.index;
I need to start from 1, but the .index is starting from 0:
0
return str + ('000' + (item.index + 1)).slice(-3);
Very nice! Thank you so much!
(But it still starts from 0, not 1.)
In the 'Replace > Replace with <Inc Nr:1>' this is automatically choosing counts digits like below.
If we have 9 pictures - digits like this: 0-9.
If we have 99 pictures - digits like this: 00-99.
If we have 999 pictures - digits like this: 000-999.
Is it possible to do it so? Just not manually choosing digits as I chose '000'.
(Hope I explained well - English isn't my native language.)
(But it still starts from 0, not 1.)
In the 'Replace > Replace with <Inc Nr:1>' this is automatically choosing counts digits like below.
If we have 9 pictures - digits like this: 0-9.
If we have 99 pictures - digits like this: 00-99.
If we have 999 pictures - digits like this: 000-999.
Is it possible to do it so? Just not manually choosing digits as I chose '000'.
(Hope I explained well - English isn't my native language.)
Reply to #3:
I'm sorry - your question does not make any sense at all. Try posting an example of what you are trying to achieve.
Your original question described a script: "str + item.index " will add the item number of each file in the list starting with zero. If you simply add 1 to each number : " str + (item.index + 1)" then the numbering MUST start from 1 so I do not understand why you say it doesn't. You have to enclose this statement in parenthesis otherwise "str + item.index + 1" will add the character "1" to the end of the string plus item number.
The tag "<Inc Nr:1>" also adds incrementing numbers starting from 1 - NOT zero - so again your comments puzzle me.
I'm sorry - your question does not make any sense at all. Try posting an example of what you are trying to achieve.
Your original question described a script: "str + item.index " will add the item number of each file in the list starting with zero. If you simply add 1 to each number : " str + (item.index + 1)" then the numbering MUST start from 1 so I do not understand why you say it doesn't. You have to enclose this statement in parenthesis otherwise "str + item.index + 1" will add the character "1" to the end of the string plus item number.
The tag "<Inc Nr:1>" also adds incrementing numbers starting from 1 - NOT zero - so again your comments puzzle me.
Reply to #4:
Currently, I am using the code below.
var rp1 = /-\d+(\d{2})$/;
var nbn = item.newBasename;
var nn1 = nbn.replace(rp1, '_');
return nn1 + ('00' + (item.index + 1)).slice(-2);
// I don't want to write '00' and nor '-2' in slice()
// This code works perfectly, but I don't need to manually change '00', '-2' each time I want to use the script.
I am just looking to do it automatically. And need to use just the script for it.
Currently, I am using the code below.
var rp1 = /-\d+(\d{2})$/;
var nbn = item.newBasename;
var nn1 = nbn.replace(rp1, '_');
return nn1 + ('00' + (item.index + 1)).slice(-2);
// I don't want to write '00' and nor '-2' in slice()
// This code works perfectly, but I don't need to manually change '00', '-2' each time I want to use the script.
I am just looking to do it automatically. And need to use just the script for it.
Reply to #5:
I'm sure this question would not make any more sense if you wrote it in your native language.
We cannot read your mind - JUST TELL US WHAT YOU WANT TO DO AND GIVE BEFORE AND AFTER EXAMPLES!!!!
I'm sure this question would not make any more sense if you wrote it in your native language.
We cannot read your mind - JUST TELL US WHAT YOU WANT TO DO AND GIVE BEFORE AND AFTER EXAMPLES!!!!
Reply to #6:
I need to use the Script to rename files or folders. I am changing these numbers regularly.
I used this script last time, and there were over 120 images - so I used triple 0.
return nn1 + ('000' + (item.index + 1)).slice(-3);
Now I need to rename the 14 images - I have to use double 0.
return nn1 + ('00' + (item.index + 1)).slice(-2);
https://i.snipboard.io/weDNB7.jpg
Hope I explained well, if not sorry for your time.
I didn't mind to bother someone else.
Have a good one.
I need to use the Script to rename files or folders. I am changing these numbers regularly.
I used this script last time, and there were over 120 images - so I used triple 0.
return nn1 + ('000' + (item.index + 1)).slice(-3);
Now I need to rename the 14 images - I have to use double 0.
return nn1 + ('00' + (item.index + 1)).slice(-2);
https://i.snipboard.io/weDNB7.jpg
Hope I explained well, if not sorry for your time.
I didn't mind to bother someone else.
Have a good one.
Reply to #7:
You do not need to use a script - just use a New Name method...
New Name: <Substr:1:->_<Inc Nr:1>
You do not need to use a script - just use a New Name method...
New Name: <Substr:1:->_<Inc Nr:1>
Reply to #8:
It's part of a big and complex script. (private)
That is why I have to use the script.
It's part of a big and complex script. (private)
That is why I have to use the script.
Reply to #8:
I found what I was looking for from your responses to others' concerns.
app.parseTags("<Inc Nr:1>")
Thank you so much!
I found what I was looking for from your responses to others' concerns.
app.parseTags("<Inc Nr:1>")
Thank you so much!