MACRO: Run or edit recent (edited, created, or used) macros from a list

When I saw @ComplexPoint's N Most Recent Macros macro this morning, I knew I wanted to have its output in an HTML prompt window, where I could easily run or edit any of the listed macros.

After some ugly get-it-done brute force work, and some help from a couple LLMs with the fixed-header scrollable table, here's the result:

This is 100% full credit to @ComplexPoint! I couldn't ever have written what he wrote; I just used his macro and forced his output into the format I wanted to use it in. Kudos, Rob, for a very slick bit of code!

Download Macro(s): __Recent macro browser Macros.kmmacros (29 KB)

Macro screenshot

Keyboard Maestro Export

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.7.1
  • Keyboard Maestro v11.0.3

Click the buttons at the top to choose between which set of macros to view, and that's the extent of the interface :). Note that this is not updated in real time when you click the buttons: I call @ComplexPoint's macro three times when the macro launches, then just display those results. To update the lists, you need to run the macro again.

There is only one variable in the macro, the green box near the top where you can set the number of macros to retrieve.

There are a ton of inefficiencies in this macro: I just call the JavaScript three times, instead of trying to muck through changes to make it get all three data sets in one go. I didn't try to delete the line of text that's added in the JavaScript; I just regex it out afterwards. The HTML could be written on the fly in the JavaScript. And the list goes on..........

But it works, and it didn't take me that long to put together. If anyone wants to optimize the thing, have at it—please!

-rob.

3 Likes

Nice,

Can it list the unused first then oldest use to newest use macros? (ie. least used to most recent used)

As in this solution from @ComplexPoint

I honestly have no idea: I just take the output from his macro and show it in a list. So all I can offer is what's there: Created, Edited, and Used.

I could probably figure out how to offer a Sort button, but I don't think I'll be able to get to that today.

-rob.

ok, thanx,

If you get a chance to look at @ComplexPoint's

it also puts out a list, maybe that list could be implemented into your solution...
no biggie in any event.... really...
Thanx for your time and expertise Rob
Cheers

Based on a quick look, the time format is different, so that would require handling in some way. But if there were a Sort button on the one I wrote, then you could sort Used in reverse order, and wouldn't that get you unused?

-rob.

Yes, as long as it was showing all macros and not just a sub-set of them. (ie. just the last 20)
I would need to know that all macros were in the list then yes, if I was able to 'reverse' sort them, that would do the trick! -

I get an error

2024-11-29 14:18:53 Execute macro “Browse lists of recent macros” from trigger Editor
2024-11-29 14:18:55 Action 16462339 failed: Execute a Subroutine action failed to find the macro to execute
2024-11-29 14:18:55 Execute a Subroutine action failed to find the macro to execute. Macro “Browse lists of recent macros” cancelled (while executing Format recently-created macro list).

Ah crud, the export left out the subroutine! One moment.

-rob.

If anyone downloaded before seeing this post, please download again: The original upload was missing the subroutine macro. All fixed now in the download link in the first post.

Sorry;
-rob.

text window stays open and you can see what my HTML window looks like in the screenshot....
all good...

I've uploaded a new one that gets rid of the text window (debugging step left active)—you can fix by just deleting the Display Text action after the three purple subroutine calls in the main macro if you don't want to re-download.

As for the display, I'm stumped: I downloaded the uploaded macro onto two Macs that had never seen it before, and it worked fine on both. What macOS and Keyboard Maestro version are you on?

-rob.

1 Like

hmmmm, I ran for 10 macros and it was good, back to 20 macros and mini html window... I'll work with the new bit you suggested

EDIT: must be something with one of my macros, run for 12 macros, html window good, run for 13 and above, get mini html window...

bro, no worries... it's not that important....

THANK YOU AS ALWAYS man...

Troy

I would guess it's something about the name, a character that's messing up the HTML somehow. I'm not actually filtering the names for HTML characters, so that's possible. If you find out which one it is, please let me know.

-rob.

1 Like

Thanks to an LLM that will rename nameless, here's a version that includes sortable columns—this feature is 100% none of my work, but it seems to work in testing.

__Recent macro browser - sortable Macros.kmmacros (32 KB)

Each column header has up/down arrows for sort direction; click to sort:

Let me know how this works for you—I was impressed that the LLM got the sort working on the first try.

-rob.

1 Like

Do any of your macros, by chance, include " :: " (space-double colon-space) in their names?

-rob.

Cool macro, @griffman. Thanks for sharing. I'll be using it for sure.

I've shared a macro with intersecting features. With my macro, everything is based off the executed date. Also, one of the key objectives was to quickly edit (or run) a recently used macro without taking my hands off the keyboard. Of course the amazing Prompt With List action is a great tool for that job.

One common characteristic with your macro is that it includes some of @ComplexPoint's adapted JXA. :grinning:

Edit a Recently Executed Macro

2 Likes

I actually started this one with a Prompt With List, but I wanted to include the macro group and detailed date, and you can't align text in a Prompt With List. Hence the switch.

What I really want is Prompt With List With HTML and CSS Table Support :).

-rob.

1 Like

no, I have no macros that include " :: " in their name.
But the list that @ComplexPoint puts out has that in every line item, I'm sure you know that.

Yea, and it's what I split on in the regular expression, so I thought maybe that would be causing an issue if it was in a name.

-rob.

1 Like

I have names that include:

⌘
`
/
@
[KM]

I am trying to eliminate by running the report and changing macros that have been used but can't seem to find a rhyme or reason...
Although I am sure there is one....

NOTE:

I Think this name is stopping it
z Mod Multi Tick ` x 1

NOTE:
Yes, the ` was cause up to this point.... I removed it and now I'm counting up to see if I can get a list of all 2700 macros (down from 3300!).....
Progress not perfection.... one step at a time...

Yup - it did it, all 2,760 of them. I just 'scroll' to the bottom and I can start working with removing the 'never used / oldest usage' macros....

you ROCK....
and also @ComplexPoint !!!! THANK YOU.... good stuff man....
cheers

1 Like