Sometimes it is useful for a process to be able to increment characters like numbers, e.g. when creating multiple files with the same name (My_File_a, My_File_b etc.).

While using a number to iterate is more straightforward, using a text character can be a little tricky. To achieve this, we can use the "Run Javascript" Action, in order to use its text manipulation capabilities.

Let's assume that the index (initial character) is kept in the %Char% variable.

By using a Run JavaScript action with the following code,


var c = '%Char%';
var ret = String.fromCharCode(c.charCodeAt(0) + 1);
WScript.Echo(ret);


we get the next ASCII character from the one we had. In this way, for example, if %Char% is equal to 'n', then the output of the Javascript action will be 'o'.

Note: It is the developer's responsibility to make the necessary checks before running this code; cases such as 'z', 'Z', text strings, or non-letter inputs should be accounted for to ensure that the Process behaves as expected.