Two digit counter? 01, 02, 03, ... , 09, 10, 11,

I am incrementing a variable — “Count” — and using it to name files. Is there a way to set the number of digits in the Variable “Count” to 2 or 3, so that it counts up from 00 or 000?

The incrementing Action is simply "Set Variable Count to “Count + 1”.

The naming Action is done from the System Clipboard. The Clipboard is set with
"%Variable%Name% SomeTextHere %Variable%Count%"

I have not tried any work-around inside KM. Currently I process the files in Name Mangler with a regex that adds a zero where missing. I looked into the KM Action “For Each” using the Collection " The Numbers", but I saw no number-of-digits setting there.


1 Like

In the Set Variable to Calculation action, set the format to 00 or 000 (select Format Result from the Action/Gear menu).


:blush: Fantastic. KM continues to amaze me.

Thank you much.


Great answer… “format result” is great!