Feature request - highlight color to macro name in macro list in km editor ui

I use my own method to record the number of times each macro is used. Then I sort them from high to low in Excel. I get the table below. I want to group them into groups of ten. The first group is the top ten macros. The second group is from 11th to 20th, and the third group is from 21st to 30th.


In the folder of keyboard maestro editor, I want to see the frequency of use of a certain macro at a glance. I want to know this information when I edit them.
The method I use now is to add spaces in the front of the macro name. Adding eight spaces is the first echelon, adding four spaces is the second echelon, and adding two spaces is the third echelon. As shown in the left picture below. You can see that this is not clear. So I wonder if I can use highlight color to group them in the macro list. As shown in the right picture below.

How did you generate the image on the right? Is that a KM feature that I'm unaware of?

May I ask what the meaning of "FM n.n KM" is at the front of all your macro names? I'm curious.

You are free to solve your problem any way you want, but if I were trying to solve this problem, I think I would start each macro with seven characters like these: "[nnnn] ". The number in the brackets would represent how many times the macro was called. Using a call to a macro, I think I might be able to find a way to have each macro modify its name to have it count its call frequency and modify its name based on that.

The image on the right is what I made in photoshop. I want to show you what iam thinking.
I have added a lot of prefixes to distinguish them and mark them and group them. That's why I want to add a highlight color function here. This will allow me to reduce a few prefixes.

I see. Thanks for explaining. I'm unaware of any such feature in the KM Editor. If there was such a feature, it would also have to work in both macOS' Dark Mode and Light Mode. The person who makes KM may possibly put this idea on his ToDo list, but on the other hand he may not.

I think that the closest you can get at the moment is to colourise or set the macro icons. You seem to be using the defaults most of the time -- you could create different coloured icons 1 through 4, for example, then sort your macros by "Use Count", select a batch, and apply the appropriate icon using AppleScript.

It wouldn't be very obvious -- but it would be more obvious than now!

1 Like

I can hardly call what's in my head a brain, compared to yours. Good enough.
Red means 1-10, Green means 11-20, Blue means 21-30.
Avoids sorting changes due to inserted spaces.


Thanks

I noticed that there are two lines related to this in the macro plist.

<key>CustomIconData</key>
<string>KMEP-Record</string>

This involves a question I have been thinking about for a long time. How to edit and modify macros by editing and modifying macro plist file. If I succeed, I can make a macro to change macro icons in batches. I studied it for a morning but failed. I will continue to pay attention to this topic.

The CustomIconData key is tantalizing but to AppleScript read-only, I believe.
I don't think the macro object has an AppleScript element (like "trigger" or "action") or property (like "name" or "enabled") that allows writing to the part of the xml that contains the CustomIconData key/value .

FWIW, here are image captures of the Keyboard Maestro Scripting Dictionary.

Even "make new macro with properties{name:"macro 1",enabled:true} won't accept xml as a property. When I tried "make new macro with properties{xml:modifiedPlist}", the script errored: "Keyboard Maestro got an error: AppleEvent handler failed".

Sorry...

2 Likes

Copy your icon to the Clipboard. Select your batch of macros in the Editor, then run an AppleScript that

  1. Gets the selected macro IDs
  2. For each ID in the list
    1. Opens the macro with that ID in the Editor
    2. Presses the tab key to select the icon field
    3. Pastes into the icon field

I implemented this the first time. But I think it is a mechanical way, not an AppleScript way. We just use AppleScript to perform a series of mouse and keyboard operations. If you can't reference the icon button and then do an AppleScript set, it's not the pure AppleScript way.

The "AppleScript Way" of this method is the getting of the selected macros -- allowing for more accurate targeting when setting icons via the Editor UI. The reason for doing the UI steps in the AppleScript too is that it's a lot quicker than using AS to open a macro in the Editor then KM to make the changes -- the second requires you to instantiate a new AS environment for every macro you edit, the first is just a single instantiation.

Editing macros by directly modifying the plist is actively discouraged. It'll be especially dodgy to do via a KM macro because that'll mean editing the plist while the Engine is running... You might be able to change the icons programmatically via a script, but you'd better make sure your backups are up to date!

1 Like