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]


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/9/4/94dcb8f6d1e5b35db9984937180d444855714bf6.kmmacros">Repeat Loop with counter [Example].kmmacros</a> (3.1 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|586x777](upload://bfw3B4JEjnI4PMy6307eDrkKKd5.png)

This worked perfectly - THANK YOU!