Show Most Recently Run Macro via a Macro

Is there a way to show and select the most recently used macro via a macro in Keyboard Maestro. I often find myself tweaking or updating a macro that was last run and find it faster than trying to search for it or go sorting by last run macro.

There has to be a much more elegant way to do this then the macro I have been running that works 95% of the time and so far about 99% the second time the second time it is run.

It basically looks for the All Macro group, and sorts by date used, clears the search field and then goes down one macro since the last executed macro would be the macro searching for the last executed macro.

Keyboard Maestro - Show Most Recently Executed Macro.skillet.kmmacros (98.2 KB)

Something I use quite often in TextExpander is "Edit Last Expanded Snippet" which is the same thing I am trying to do for Keyboard Maestro.

I'm pretty sure that's what this button does:

Thanks Dan, you know I vaguely remember clicking on that button once before. I searched the menus and guess I have such an aversion to clicking on buttons my eyes don't even go there. I also just found the upload macro commands straight from Keyboard Maestro for the selected macro and "select recently edited macros" button thanks to you.

Keyboard Maestro - Show Most Recently Executed Macro v2.skillet.kmmacros (35.0 KB)
So this new update below seems to be the fastest way to have a macro go to the most recently run macro with a global keyboard shortcut. It runs much faster and thankfully that button clears the search out also. Plus I really like that it takes me to the macro group too instead of the All Macros smart folder which I never really liked for my macro to take me to but that was the only way I could think to do it.

Honestly, I don't use it. I just remember reading how other people use it.

There's so many things that I, like you, haven't even tried out. Just the other day I happened to click on the "Paste" menu item in the KM Status Menu. Holy crap is that thing useful! Never even noticed it until I accidentally clicked it. :slight_smile:

Wow, never noticed that either until just now, anything else you want to tell me LOL :slight_smile:

1 Like

Thanks for sharing.

What does the Action typing ^⌘E do?
I couldn't find that shortcut?

Sorry I should have made a note about the shortcuts. It sorts macros by "Date Used" found in the View menu.

I just realized a mistake in the macro which brings me back to the original problem and that is running a key command to find the last run macro (that of course is not the macro you just ran). This will take me to my global macro pallet first (because I am running the macro to open the last macro) and then to the last run global macro rather than the last run macro.

There's got to be a way without manually opening up Keyboard Maestro and then clicking the icon to get to the last macro with the macro group selected since that is what the button already does. Otherwise I guess I am back to the old version one of this macro.

OK, thanks.

Some suggestions:

  1. Rather than Click on found image, use the script by @ccstone to click on the Recent Run menu
  2. After this, a Pause 0.2, Down Arrow twice, and RETURN will edit the macro run before this one.

I'm not sure I see the point in the remaining actions in your macro.
Since you have already selected the prior run maro, how does changing the sort help you? Perhaps I'm missing the objective of your macro?

Great thanks, exactly what I was looking for!

This command allows me to sort by most recently run macros which is useful to quickly see macros that are linked to the triggered macro. For me I often have macros reference another macro so I don't have to update in so many places. Of course the triggered macro will not show if the referenced macro is outside the macro group since the new update to this macro no longer shows the smart folder of all macros (which overall is a good thing). I can't think of any macros that I have that reference macros outside the group they are currently in so for me this is not a problem.

Thanks Dan and Michael this final one should do the trick with a macro variation of choice thanks to Chris' fine AppleScript.

Show Most Recently Run Macro.kmmacros (54.1 KB)