KM 7.0: Type a keystroke action and repeat, hold

I am trying to understand how the Type a Keystroke action works with the various options available:

  • Press and release
  • Press and hold
  • Press and repeat

In particular the last one, as setting this and then invoking a macro which just contains a single character, does not cause the keystroke to repeat.

Hey Victor,

You're not being clear about what you are doing.

What version of OSX?
What version of Keyboard Maestro?
What is the trigger?
What is the macro doing?

This is KM7:

'Is Down' invokes key-repeat, and it types 'J' repeatedly — although not as smoothly as the System.

In Mountain Lion through Yosemite key-repeat is turned OFF by default, and when you hold a key down you get the Accent-Menu (Unicode permutations of the letter if applicable).

If this is your issue you can learn how to turn it off here.

If that's not the problem then please explain in more detail.

-Chris


OSX 10.10.4 ~ Keyboard Maestro 7

Victor is talking about the new abilities in the Type a Keystroke to press and hold a key.

A normal keystroke involves pressing and releasing the key.

You can Press and Hold or Press and Repeat, either of which result in the key being held down and the macro continuing. The difference is with Press and Repeat, the key is held down and periodically released and repressed, just as happens if you press and hold a repeating key on the keyboard.

Either way, you can later release the key using a copy of the action with the Release option. Or once the macro completes, the key is automatically released.

Peter is right. But a simple macro such as

does not cause the 'x' character to repeat. It is only typed once. I tried this in a text editor and LibreOffice but the result is the same. Am I missing something?

Aha!

Okay, I understand why Victor is confused, because I cannot get a similar macro to repeat automatically with any combination of settings.

I have to use press and keep the keyboard shortcut pressed.

-Chris

Because the key stays pressed only as long as the macro continues to run.

As @ccstone pointed out, you can have the trigger repeat by adjusting the trigger to "while down" instead of "is pressed".

If you want the Press and Repeat variant of the action to work, then that macro itself must continue to run. So to repeat the "x" key for 5 seconds, you would do:

  • Press and Repeat the X Keystroke
  • Pause 5 seconds
  • Optionally: Release the X Keystroke

The last action is optional because when the macro complete all keys are released.

I trust that is clear.

The reason for this is that otherwise you have keys on your keyboard effectively stuck down, which can lead to far too much confusion. Its why I have not implemented this feature at all until 7 version in.

Hey Peter,

Clear as mud. :smile:

Until you try it.

It's very counterintuitive to have a macro auto-run while it's been told to pause — or so it seems to me.

But. Now I've seen it in action I can work with it.

I think your basic example should be in the wiki.

-Chris

The action is not "auto-running". The key is being held down (and optionally repeating). That's what the action does. It presses and does not release the key.

Then later you can release the key with the release variant.

And if the macro finishes, then it is implicitly released, essentially as a safety feature. This also works for mouse buttons, and you can image the problem you'd be in in Keyboard Maestro held the mouse button down and did not release it - your Mac becomes almost unusable. Same for modifiers like the Control key.

You can do these things, but you have to try pretty hard now.

Well, hopefully that's some further mud to ponder.

Hey Peter,

Ah. That puts it into a more comprehensible context.

I can't think of a personal use for this feature, so my circuits are safe for the moment.

-Chris

Thank you for the further explanation. I have tried the following, based on what Peter wrote:

But this just causes a single character to be typed.

Am I still missing something? Not sure why I want to use it yet, but just examining some of the new features in KM7.0.

I looked in to this, and I believe it is repeating, it is just that the system behaviour for repeating keys no longer does anything in most applications. Instead, pressing and holding a key is a sign to do other magic. (eg, press and hold “e” produces a popup to select various accented e’s).

Terminal still honours repeating keys, and the macro above works as expected in Terminal.

I think it would be very useful to have a "key combination X behaves exactly like key Y" option when setting up keyboard substitutions.

So I can set "Command-H" to "Left Arrow" and it will behave exactly like the arrow key. Holding the key down, key repeat, etc.

These options are very complicated when I'm guessing many people just want "key X should type like key Y".

This is just a note (from June 2023) that may be of use to anyone reading this old conversation.

The behaviour for repeating keys can be changed with the following command:

defaults write -g ApplePressAndHoldEnabled -bool false

Then quit the applications that you want to adopt this new behaviour – or simply restart or log out.

For more information, see this Web page, "How to enable keyboard repeat on a Mac".