Delay After Enabling Macro?

I have a macro that is triggered by a 'hotkey' - this works fine.
Nothing sophisticated is going on in the macro.
The last action in the macro is
1 - enable another macro - that has been disabled (this works correctly)
that macro runs and then disables itself at the end

That macros 'trigger' is a regular expression match of (\d\d\d\d) (4 digits)
So it's waiting for me to type 4 digests.

  • I cannot type the digits quickly after the macro is run, I have to wait at least 3-4 seconds and then it works, taking the 4 digits that I type.
    If I start typing 'quickly' after the macro is run, say within a second or so.... I type 4 digits and nothing, but if I type a couple more digits it recognizes the trigger.
    As a test, if I run the second macro directly by itself with a preface, say
    tt(\d\d\d\d) - I can type instantly after the preface and it works.
    Why is there such a delay after enabling a macro, or is that common behavior?
    thanx

The behaviour depends on whether the editor is running or not.

The engine makes the change to enable/disable the macro, and then if the editor is running, then it is notified about the change, which means the editor will make the change and then save the macros and notify the engine of the change. As with all macro changes, there is a slight delay while changes are coalesced. Eventually the changes are saved and the engine notified. At this point, because of the macro change, the typed string queue is zapped.

It probably does not need to be zapped at that point, so I will look in to whether that can be avoided.

1 Like

Should be resolved for the next version.

2 Likes

Hey Peter, awesome software.
I really hope those delays mentioned above are resolved for the next version.
I'm using those keys a lot!
Just mentioning it 'in hopes' =)
Cheers

After enabling a sub-macro via a master macro, I still have to wait for 2 seconds or so before I can enter the 4 digits that are used in that sub macro.
Those 4 digits are the trigger of the sub-macro and regex is used to 'extract' a day and time.
If it helps I can thin out the macros and post an example.

@troy, perhaps Peter will have a solution (or at least an explanation), but here's an untested idea: Have you tried putting the sub-macro in a separate Macro Group that you "deactivate", and then "activate"?

Activate/Deactivate will always be much faster than Enable/Disable, especially if you have the KM Editor running (which I almost always do). Enable/Disable causes a whole bunch of stuff the KM does under the hood that you really don't need.

1 Like