Context Menu and KM Palette

Can KM detect that a macos context menu opens and open a palette at the same time? And vice versa close the palette again when an action is triggered from the context menu and the menu closes again?
Thanks!

Not directly.

You'd probably have to use a found image.

If you drive the contextual menu with AppleScript and select the action in question first, you can do something like this:

tell application "System Events"
   tell application process "Keyboard Maestro"
      tell (first window whose subrole is "AXStandardWindow")
         tell group 6
            tell splitter group 1
               tell scroll area 3
                  tell (first group whose selected is true)
                     perform action "AXShowMenu"
                  end tell
               end tell
            end tell
         end tell
      end tell
   end tell
end tell

Thanks Chris, no I am not looking for a image. It is an absurd problem. Maybe I'll explain briefly.

A selected item of a context menu can normally be triggered with Enter or with Space. Unfortunately only Enter works for me. But I want space.

So I made this attempt. If this KM palette is open before I open the context menu

image

Then I can trigger with Space.

The problem is that the palette does not close with the context menu. So space is always enter. Do you understand? :joy:

I remember you bringing up this problem.

What about adding an action to your Space = Enter macro to make the palette close when you hit the hotkey (space)?

I don't think that's going to work. Or maybe I don't understand what you mean.

The flow is like this. ⌘+space opens the context menu. Then I type the first letter (or the first two letters) of an item. The item is selected. And now I would like to be able to trigger with space (instead of Enter).

Right, so:

  • Cmd-Space opens the Context-Menu and your palette which changes Space to Enter.
  • You type your selection.
  • You type Space to activate the Space = Enter macro.
    • This macro closes its parent palette.
  • Cmd-Space opens the Context-Menu and your palette which changes Space to Enter. --> WORKS!
  • You type your selection. --> WORKS!
  • You type Space to activate the Space = Enter macro. --> WORKS!
    • This macro closes its parent palette. --> does not work

Space triggers the action of the context menu, but it does not close the palette.

If I set: "show palette for one action", the palette is already closed when typing the first letter of the item in the context menu.

If I set: "show a palette until", the palette remains open.

Okay, don't use a palette then.

Use a macro group that you can activate and deactivate at will.

Ah, ok, good idea. I'll test that and get back to you, for now thanks, Chris!

1 Like

That's how it works with a palette, thanks Chris!

1 Like