Replay macro N times

So I can record a runtime macro and play it back with a key stroke.
But can I play it back N times, where N is a number I type?

Yes, you can, just use some register signalling and goTo.

Trying to do something like

Which would give me TEXT TO INSERT 90 times, I’ll have a proper read of the docs again.

Hi Tunney, did you manage to achieve what you wanted to do?

I’m actually trying to do something similar but didn’t have much luck so far

No joy I am afraid.

Please wait with this until next release… there are going to be ground breaking changes in variable/register syntax…

Then, Following suite of of macros should do the trick:

On number keys (e.g., for key 3)

setVar repeatCount ($repeatCount*10 + 3)

Then your i key:

playMacro $thisKeyId
setVar repeatCount ($repeatCount - 1)
if ($repeatCount > 0) goTo 0
1 Like

Wow, that will be great!!!

I really did try to resist asking this question… but any idea on when this firmware will be released please?

Very soon.

Here you go: Release 10.2.0 · UltimateHackingKeyboard/firmware · GitHub

Hopefully, compatible agent should come soon, which will be able to show configuration errors when config is saved.

Quick question for you on the deprecation of registers. For the most part I know how to update my macros and all makes sense. Bar this one:

ifShift recordMacro #key
ifNotShift playMacro #key

I have the same macro mapped to all my numerical keys.
Is there a variable that means “this key”?

ifShift recordMacro $thisKeyId
ifNotShift playMacro $thisKeyId

also is there an alternative to the active waiting state? Being told it is deprecated!

really loving the firmware!

1 Like

goTo $currentAddress

Really appreciate your help here Karel.

I just realised why I couldn’t find the information I needed… massive user error, i was looking at the wrong docs…

:grin: :wink:

I’m having a few issues with my syntax for if statements. I cannot figure out from the (correct) documents what I am doing wrong here. Any ideas please?

Warning at repeatCount 1/1: Unprocessed input encountered.

1 ~ if($thisKeyId == 65) setVar thisKeyValue 1

:person_facepalming: I should have foreseen this.

The grammar is literally if BOOLEAN COMMAND, i.e., space after if is mandatory.

(Parentheses are a property of the boolean expression, not a property of the if keyword.)

But despite my intention, the parser should actually not mind. And indeed my UHK processes if($thisKeyId == 65) setVar thisKeyValue 1 without any complaints.

What is the actual macro?