How to trigger a palette (plus macro) with ⌥a+a?

When I open a palette, it helps me if I can trigger my most used macro (of this palette) with the same shortcut I use for the palette.

Example:
⌥+a+a opens the palette, triggers the macro with the shortcut ⌥+a and closes the palette.

(Explanation: ⌥+a opens the palette and additionally a macro of the palette is triggered with ⌥+a. This must work without conflict. I know that I could trigger the palette macro with "a" only, but ⌥a+a feels more natural.)

For this, my simple macro works. What doesn't work, unfortunately:

If I only press ⌥+a, the palette should stay open. I have not been able to do this with "If Then Else".

Can someone help? Thanks a lot.

Palette TEST ⌥a+a.kmmacros (2.7 KB)

If necessary, this is the palette
Palette : Macro Group TEST Macros.kmmacros (10.9 KB)

I'm a bit tired and can't quite get my head around your setup, but the first thought I had was:

Pause until key "A" is down (timeout 0.5s)
If action condition is OK hide palette
Else do whatever "A" does

Hi Neil, yes I was thinking in that direction too.

If the second "a" is missing, then leave the palette open. But I have not been able to get this to work.

Ah, do you see a way to do that with your multipress macro? Unfortunately I have not been able to do that either.

This does not work either. I could now list 100 more variants that also do not work, but I'd rather do without. :joy:

I don't understand why this doesn't work. If after the first "a" a second "a" goes down and up, then close the palette, otherwise leave it.

You might be able to do a situational test:

if palette is not open then
   open palette
else
   trigger macro
   close palette
endif

So if your palette title is "Palette / Macro Group TEST" you'd:

Palette Test.kmmacros (5.0 KB)

It looks like that will always be false -- A can't be both up and down at the same time (the two conditions are simultaneous, not sequential).

Have you tried what I suggested? I ask because you haven't shown me that you have.

Thank you @Nige_S , do I have to enter the name of my palette each time? Like this? Unfortunately it does not work.

@noisneil I have tried 1000 things, maybe that too. But I'm not sure exactly what you mean.

@noisneil Excuse my stupidity. Do you mean something like this?

Does not work how? I only put in what you should do as comments, have you replaced them with the actual actions you want to take in each branch of the "If... Then... Else"?

I should have been more clear about that -- but it's quite difficult to include proper actions to show/hide palettes and/or trigger macros when you have neither the palettes or macros on your own machine!

Of course, and I thank you and @noisneil very much for your help, but this is just too complicated for me. I don't know how to do that. I give up. :slightly_frowning_face:

You've already done it in your own macro.

Where I've got the comment "Palette open -- Execute Macro", drop in your action that executes the macro you want to run on the second press of ⌥A. Follow that with a "Hide Palette" action if necessary.

Where I left the comment "Palette not open -- Show Palette", drop in your "Show Macro Group Palette" action.

I think a conflict palette would work well here

Please explain how. How can I type ⌥a+a? Even if the trigger of the palette were "a", it is not ⌥+a. So I would have to release ⌥ first. Or am I wrong?

Sorry - I was wrong - I didn’t read your OP properly. Ignore me.

As I said, I'm not totally sure how you want it to work, but this here's what I was getting at:

Palette Test.kmmacros (23.5 KB)

Macro Screenshot

Thanks @noisneil. This works more or less as I wanted. However, the shortcut (⌥+a) of the most used macro on the palette must be disabled, otherwise a conflict palette appears. This means that if the palette is already open, this macro cannot be triggered with the shortcut. Maybe this could be solved by switching the macro groups on and off somewhere... or maybe not :thinking:

But you know what, I found a very simple solution with KM and BTT.

  • The first ⌥+a opens the KM palette with BTT.
  • The second ⌥+a triggers the macro of the KM palette with KM.

The second ⌥+a (trigger for the palette macro), however, is not passed to KM because BTT apparently operates at a lower level (⌥+a is already occupied by BTT to open the palette). So I deacativate BTT for 0.2 s (after opening the palette), the shortcut is passed to KM and BTT reactivates itself automatically. This all takes place in the background without you noticing anything.

You may think that's complicated. For me it's the other way around. This way I understand exactly what I am doing. Totally opposite to a KM macro that might work (if you put in another 15 hours of work :wink:), but I have no idea how to build it.

Once again KM and BTT have proven to be a good team. Thanks again @noisneil & @Nige_S . I might be too stupid for KM alone, but I almost always find a way with the "Duo Infernale". :smiley:

2 Likes

Why does it need a shortcut at all? That's what the Execute a macro action is there for.

:man_shrugging: The macro is executed when ⌥a+a is pressed. But not when the palette is already open and only ⌥a is pressed.

Ah, I see, even with an open palette ⌥a+a must be pressed. Well, then we have achieved exactly the same thing in other ways. :slightly_smiling_face:

1 Like

This is my variant. It works -- once. For some reason, hiding the palette deactivates the Macro Group even though "Always activated." remains selected -- you have to select another option then reset to "Always activated" to make it work again.

If anyone knows why, I'd love to know!

Frankb Palette Macros.kmmacros (10.4 KB)

Image of main macro

1 Like