Variable that increases by 1 for each Repeat

I have a macro that has a Repeat a [user input] number of times. There is one particular action inside the Repeat that I want to happen an extra time for each Repeat. So "Type Keystroke: Down Arrow" 1 time during the first pass, 2 times the second pass, etc.

Can I have a variable that's a number that increases by 1 for each repeat? So set 'x' to 1 at the beginning of the macro, then for each repeat x+0, x+1, x+2, etc.

Thanks!

1 Like

Yep. Very easy using the Set Variable to Calculation action.
Here's an example macro to get you started:

MACRO:   Repeat Loop with counter [Example]

~~~ VER: 1.0    2019-04-05 ~~~

DOWNLOAD:

Repeat Loop with counter [Example].kmmacros (3.1 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


image

This worked perfectly - THANK YOU!