Reduce repeat interval of Type Keystroke action

I'm using a keyboard that do not have the arrow key, so I'm using keyboard maestro to map some emacs shortcut as shown above.

But I found the "Press and hold" option is not repeat the key as fast as other keys that not mapped by keyboard maestro and obey the system preference of macOS 10.12. Is there any way to reduce the repeat interval of this action? Thank you.

Update:

I found my macro works in system key repeat rate after restarting my mac.

It seems due to I previously changed the KeyRepat by defaults write NSGlobalDomain KeyRepeat 2 but system do not accept a string 1 (it should be defaults write NSGlobalDomain KeyRepeat -int 2).

As a result system fallback a slow repeat speed however it do not change the origin repeat rate itself used until restated. At the same time, keyboard maestro obey the new speed immediately.

That's why I thought Type Keystroke action is slower than system. I must update my post to avoid misleading other people.

Also, I noticed that my macro (and those with changes suggested by @peternlewis ) will keep triggered when I holding the shortcut and released as if it has inertia. But @JMichaelTX 's solution do not has this issue. (And also I can customze the repeat interval in the unit of time)

Anyway, thanks for all yours' kindly replies.

You might try this:

Download
Repeat a Keystroke.kmmacros (2.9 KB)

Note the Following:

  • The Macro was uploaded in DISABLED state.
  • The trigger is "is pressed", NOT "is down"
  • The first action is a Semaphore Lock, set to cancel/abort all duplicate triggers. Click on the gear/Options button to set:

    .
  • Adjust the Pause Action as needed to get the speed of repeat that you want.
  • To use, press the trigger, ⌃N, and keep holding down the "N" key to repeat.

Let us know if you have any questions.

1 Like

The trigger “is down” repeatedly triggers the macro at the system key repeat rate.

Press and Hold will only hold the key down as long as the macro remains running, so in your macro it is the same as press and release since the macro immediately finishes after the action.

@JMichaelTX’s macro will be a lot closer to what you are after.

Or even:

Press and Repeat: Down Arrow
Pause Until the key N is up

3 Likes

This is my final solution (based on @JMichaelTX 's macro):

I’ve found KM typing keys is slower than I’d like, in general. This might be related.

I’ve no idea how to speed typing up.

Generally Keyboard Maestro should type very quickly. There is some level of limit because otherwise the keyboard event queue will overflow.

Unless you have used the ill-advised Set Action Delay action to slow typing down, the defaults is to type pretty quickly (about 100 characters per minute I think).

Are you referring to Type a Keystroke Action, OR Insert Text Action?

If you are typing more than, say 5 characters, then you might try using the Paste option in the Insert Text Action.

100 characters a minute doesn’t seem very fast to me @peternlewis. That’s just under 2 a second.

I like @JMichaelTX’s suggestion of using the Paste option in the Insert Text action. This is about multiple characters so I’m using Insert Text. I’ll try Paste. I expect Type A Keystroke to be for only 1 character at a time, often augmented.

I misspoke. 100 characters a second.

Just checked it in Notes, 5.3 seconds to type 594 characters. The application makes a difference, BBEdit takes 13 seconds for example. Mail (in plain text mode anyway) takes under 4 seconds.

Using Paste for large amounts of text (more than 50-100 characters) is probably generally a good idea. Though you do then have to deal with the issue of accepting the change or preserving the clipboard.

Thanks for clearing that up. I’ve used paste in one of my macros and it SEEMS faster - even though the strings are very short. For example, “=x;=x” is something I often type - to get out of a TSO/ISPF session.

For more extensive strings I can see pasting rather than simulating typing would be faster.

And there’s nothing sacrosanct about my clipboard anyway; I assume it’s transient. Even if Copied app wouldn’t agree. :slight_smile: