Fire Macros with "Double" Keypresses?

I'm trying to see if there's a way to make a macro activate if I type, say, control + W, then another macro go off if I type control W twice? For efficiency I'm trying to assign slightly different scripts to keypresses like this, but I'm not finding a way to do it. Is there a way to something like, react to a string being typed, but only if control is being held down, or something? The goal would be to have different scripts go off depending if I typed control W once, twice or three times.

It’s hard to get this to work reliably for the reason that when you press the hot key once, the only way Keyboard Maestro can know to wait for a second tap of the same hot key before deciding which macro to fire, is to put in some kind of pause so Keyboard Maestro can think about it.

I find a simpler and more reliable way to get two alternative results from the same key is to add in an extra modifier -
⌘D fires one Macro
⇧⌘D fires a different but related Macro

This is also common behaviour for many inbuilt App shortcuts so I find it easy to remember too.

For the problems inherent in the double-tap approach a search found this:

1 Like

Perhaps this might be of help.

Thanks very much, will download and check!

Wow, thanks for this awesome example, this is exactly what I was looking for! No more assigning slightly different keys for what is almost the same script.

1 Like

I spent a bit of time improving these today. :slight_smile:

Thanks for the help, everyone! This has been great, and I have a much more efficient workflow now!

1 Like