Snap Palette to Front Window Plugin Action

The Macro Group settings control when the macro group palette is visible and when the macro group is active (which are generally tied strongly together, but you can configure the group to always be active and only show the palette some of the time).

@DanThomas and @peternlewis, thanks for the reply.

If my case, I have a macro group that I want to be always active, with an included macro that toggles the control state (ON|OFF) of another macro in the group.

When the toggled state is OFF, I want the group palette SHOWN; when the state is ON, the group palette HIDDEN.

Also, I do not want the ON|OFF state to affect the visibility of any other palette.

Maybe there is an easier way to do it, but all I could come up was this:

  • For the group configuration, set Always activated and shows/hides a palette when:

  • Also for the group configuration, set The hot key ⌃⌄⇧G is pressed.

Within the macro that toggles the ON|OFF control state, there is Execute an AppleScript action with the following:

tell application "System Events"
	keystroke "g" using {shift down, option down, control down}
end tell

Note that I was unable to use the Type a Keystroke action rather than the AppleScript.


This works, but am I missing a simpler approach? Thanks in advance!

You can use the Activate Macro Group action to control the activation of a macro group.

If that macro group is set to “Always activated and shows/hides a palette when”, then you can use the Show/Hide Macro Group variant of that action to show/hide the palette.

1 Like

Thank you, @peternlewis. I knew there must be a simpler way. This is far better because it provides direct control (rather than indirect via the hot key) and it explicitly controls Hide|Show rather than being a visibility toggle.

Thanks in particular for mentioning the variant of the action; that was a key piece I had missed. I've bookmarked that page in the wiki. :grinning:

1 Like

I may be misunderstanding what you want, but you could also do this:

image

 
This way you don't need a special macro to show/hide the palette.

1 Like

Hi @DanThomas, thanks for the reply—appreciate it!

In this particular case I want a control macro; it's doing a few other tasks, but I wanted the group palette visibility to track the ON|OFF state that the macro controls.

So my approach above works, but Peter's suggestion is better. With that said, I'll also say that your Snap Palette to Front Window v2.0 makes the whole operation perform better.

1 Like

Getting this in my log file. Any idea what I am doing wrong.

2023-12-23 17:41:07 Plug In failed with script error: /Users/michaelgilbert/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/Snap Palette to Front Window/Action.scpt: execution error: System Events got an error: Can’t get window 1 of application process "Microsoft Excel". Invalid index. (-1719). Macro “Excel” cancelled (while executing Snap Palette to right bottom of Front Window).

Also, can the macro be in same group as the palette group or do all the snap macros be in a seperate Snaps group?

Sorted - downloaded V2!

Best wishes for Xmas.