Can KM detect typing status?

Cause I assigned 2 n 4 keys (not numpad) for previous tab next tab
I just like it!

Problem is, when I'm typing something in a message box, like this forum topic, typing 1234 will trigger the previous tab next tab macros...

Is there a Trigger to restrict the macro when it's NOT in a typing status?

Keyboard Maestro can't detect whether or not a website text field is selected, no.

I think you're better off choosing hotkey triggers that don't conflict with text input.

1 Like

Unfortunately, no. There is no practical way for Keyboard Maestro to detect when you are in a text typing context.

When you type fn+2 you get "2". So you can keep your tab macro but still use the numbers if needed.

By the way, noisneil has created a macro which solves the problem even more elegantly (without "fn). "Type "J" or Do Something Else." Just replace "J" with "2."

I stand by my original position; don't use single character keys as triggers in apps you'll be typing in.

However, it's a free country/world, so here's a macro along the lines of what @Frankb is referring to.

It types 1, 2, 3 or 4 when those keys are tapped. When they're held for slightly longer, they perform actions. The timeout that determines the length of a 'long press' is quite short by default, so it still feels nice and snappy. Replace the red comment actions with whatever you want them to do.

1-2-3-4 - Long Press.kmmacros (53 KB)

Macro screenshot

Side-note: @peternlewis, it would be really handy if you could click the disclosure triangle of one action in a Switch/Case group while holding a modifier (maybe ⌃⌥?) to disclose all actions it contains.

If you option click the disclosure triangle of an action in an action list, it applies the open/close to all other actions in the same action list.

Yes, and it's really handy. I was wondering if there might be a way to open all these guys at once...


Probably he wants it the other way around. If I understand correctly, the tab switch is the main function (short press) But he can change that :slight_smile:

Ah, and I've started using your macro for keys I rarely use when writing quickly. That works fine. So, thanks again for your work.

He was hoping to be able to tap for both functions, but that's not really doable, so I figured a long-press for the tab switch made more sense than for typing.

Basically, no, sorry.

You could probably write an AppleScript to do it.

There was another thread that discussed this that you might want to look at. It starts with expanding/collapsing just Comment actions and then moves on to doing the same for all actions. You can find it here:

1 Like