Set macro group or macro icon – from a macro? [SOLVED]

Is there a way to write a macro that sets the icon for a macro or macro group? I'm not averse to AppleScript if that's possible.

I didn't see any actions that seemed appropriate, so that could be a feature request: "Set Macro Icon" and "Set Macro Group Icon" actions.

Thanks!

There is a way to simplify applying icons to Macros, Multiple Selected Macros or Groups in a couple of steps.

You need to have the icon you want to use already in an existing Macro's Icon Image Well (you can paste any image directly into the Image Well or choose an icon using the icon chooser).

Click in the Icon Image Well and copy ⌘C
Select one or more Macros (in the Macro Column) you want to apply the icon too and paste ⌘V
You can also paste onto one or more selected Groups in the Group Column.

You might be able to further automate this process in a Macro, but as it stands it still works well and is a quick way to apply the same icon to multiple Macros.

Screen Recording 2022-09-10 at 12.23.36-Animated GIF

BTW - any external image that you paste into the Macro Icon Image Well is made into an image 64x64 pixels automatically so, you don't need to pre-size any external image that you are using for a custom icon.

2 Likes

That's helpful, but not exactly what I was after, unfortunately.

Here's my specific scenario:

I'm using a Luxafor flag just outside my home-office door to show whether I'm busy or not while I'm working. I've got it set up to automatically change from green to red when I'm on a call or yellow when there's an item in my calendar at the current time but I'm not on a call. The flag turns off at the end of my work day, and I can pick a color from the macro group icon to override it or turn it off if I end my work day early.

I have a macro group that is displayed in its own macro group menu in the menu bar with the icon I've set for the group. I'd like to update the icon when the flag color changes so that the icon itself can be an indicator of the current color of the flag. (I'm aware that I can also use tokens in the custom title to show the current color, but would prefer just to see the icon itself.)

So, you have managed to get the custom title in the Menu Bar to change (using "tokens") depending on the flag but you would rather the icon itself changed?

I was going to say that I didn't think this could be done, but in the Macro Group Settings, I see that as well as setting a custom title for the Menu Bar Display of the Group, there is also an option to set the Group's Menu Bar Icon from a Named Clipboard:

And it is possible to change the contents (the icon image) of that Named Clipboard using an Action called "Set Named Clipboard to Image"

or

In other words as the image in the Named Clipboard is changed so would the Group's icon in the menu bar change.

I can't tell you exactly how to adapt your existing workflow to this (as I don't know what your Macros do) but if you have already worked out a way to change the Title of the Group that is displayed in the menu bar then you should be able to adapt that approach to this. It might be as simple as just adding in a "Set Named Clipboard to Image" Action at the points in your Macros where you are changing the status of whether you are free or busy.

Here is a proof of concept to show that if the contents of the Named Clipboard are changed the icon in the Menu Bar does indeed instantly change:

Screen Recording 2022-09-12 at 10.20.44-Animated Image (Small)

Icon for Menu Bar Proof of Concept.kmmacros (101.9 KB)

4 Likes

Where can I find this?

It is a setting in the Group, to show that Group of Macros in the Menu Bar:

Click to Show Image

Once you have selected "Display in menu bar", you are given more options:

Click to Show Image

image

Click on where it shows "With no icon" and you will get a list of options. One of those options is to set the icon from a named clipboard.

2 Likes

Thanks.
Every time I visit this forum, I learn a new amazing feature of KM.
The people on this forum are also amazing!

1 Like

Excellent – I'd somehow missed this! I will test later today and report back here with the result.

Thanks!

Very cool!

1 Like

Yes. In fact I've just made use of this for my Macro Group for Adobe Illustrator. I always want some visual indication of when "snap to point" is enabled. So, now I have a check-mark that appears or goes in my Keyboard Maestro Macro, Menu Bar Icon. (Watch the AI icon on the left in the Menu bar. It gets a check-mark on it when snapping is enabled)

Screen Recording 2022-09-12 at 18.13.51-Animated GIFF 640 12fps

Click to Show Image of Macro

3 Likes

Here's a visual indication of whether Audio Hijack is running.

https://imgur.com/a/9KvuzcD

Love it!!

2 Likes

Worked like a charm! Thanks again, @Zabobon!

1 Like

Wowβ€”thank you for this! This feels Mac-like in implementation, and I'm surprised I never thought to try it. Wonderful.

1 Like