Show macro in a palette conditionally?

I have two macros, one to screen share with my desktop and one to screen share with my laptop. Currently, both are displayed in my Global Macro Palette.

Screen sharing from my laptop to my laptop is obviously nonsensical, so I would like to remove it from the Global Macro Palette on my laptop. Same for my desktop: remove the screen share macro for the desktop, just showing the screen share to the laptop.

Is it possible to conditionally have a macro in a palette based on the machine?

You could create two macros groups, each marked as Disabled on This Mac on one Mac, and put your macros in the corresponding groups.

But in this case, I think better would be to have a single macro that shared to the other device - use an If Then Else action with the Text condition and the MacUUID token to determine which Mac you are on, and connect to the other one.

1 Like

Thank you @peternlewis, your second suggestion seems like a good solution for this particular use case. I was hoping that there was a way to dynamically adjust pallets in general, though.

This question was an exploratory exercise for a larger project: create a palette for each application which contains commonly used menu commands and executes their keystrokes. While certainly doable for simple static-menu applications, applications that have dynamic menus pose more of a problem.

As an example, consider the application Devonthink. If I am viewing an item that is a PDF, there are many PDF-related menu functions that can be performed and would be in the palette. If a plain-text document is being viewed, none of these PDF functions are available and would be removed from the palette.

I get the feeling that this is stretching the palette concept to its limits :open_mouth:

Could you take whatever logic you want to use to add/remove macros from the palette and instead enable/disable them?

I can think of at least two ways of handing this use case. Both of these are just UNTESTED, probably INCOMPLETE, ideas.

  1. Use Common Macro Group (MG) with Custom MGs
    • Create a common MG that contains all the Macros that will always be shown in the palette.
    • Do NOT set this MG to display a palette
    • Create separate MGs for each use case (PDFs, PlainText, etc)
      • Add a "Macro alias" for each Macro in the Common MG
      • Add a Macro for each specific choice for this use case
        (i.e. one real Macro for each PDF function)
    • Create a Master Macro that evaluates the App's menus and then Shows a palette from the proper MG
      • You could trigger this Master MG either by hotkey, or with an App Activates trigger.
        .
  2. Put All Macros in the Same MG, and Enable/Disable as needed
    • Enter all of the Common Macros as enabled
    • Enter all of the menu specific Macros as disabled
    • Create a Master Macro that enables the proper Macros, and disables the other macros, and then shows the palette

Approach #2 would be slower, since it takes more time to enable and disable Macros.
To create a "Macro Alias", see MACRO: Make Macro Alias by @DanThomas.

Hope you find these ideas helpful.