Edit Macro by Name

I've been trying and failing to come up with a more efficient way of editing the last run macro then going to the editor and sorting through macros by date used, but this workaround I've arrived at in the meantime seems useful enough to be worth sharing now. Using KM8's Trigger Macro by Name action's new ability to accept parameters, you can now easily tweak any macro by "searching" for it in Trigger Macro by Name once, then accessing it again through the same hotkey or other trigger you have assigned to Trigger Macro by Name. Since Trigger Macro by Name, like KM's other built-in search bars, now keeps your last input in memory, tweaking a given macro is now as quick and easy as invoking the TMbN trigger and hitting Enter.

Edit Macro by Name.kmmacros (2.7 KB)


Searching for "KM Forum -- Paste Script Block" after "Edit Macro by Name//":

selects the macro, puts it into an editable state, and activates the KM editor:

For convenience, I've also made a very simple companion macro that pre-fills the TMbN search field, so you can just tap the right arrow key (because the search field input is initially selected, so typing immediately will overwrite the pre-filled contents) and start typing the name of the macro you'd like to edit.

Trigger "Edit Macro by Name".kmmacros (1.5 KB)

(I tried to automate the right arrow key tapping as well, but was unable to get that to work)

The major downsides to this system is that it cannot distinguish between macros with the same name, and that macro names must be entered in full for it to work. Obviously this is not ideal, but hopefully this workaround will prove useful to others who also go back and forth tweaking certain macros, as it's the fastest method I've found to do so thus far.

In the editor, View ➤ Select Macro ➤ Last Used ⌘⌥-E

That is definitely a great and useful shortcut, but unfortunately it isn’t sufficient for my use case. Its primary drawbacks for me are that:

  1. You have to be in the editor to invoke it, which is admittedly not a big deal but still a step removed when I’m tweaking a macro designed for use in other apps. By contrast, this macro can be invoked from anywhere, since I placed it in the Global Macro group

  2. It only selects the macro, and doesn’t automatically put it into an editable state

  3. The macro I want to tweak may not always be the one last used or last edited, or even previously edited, and it isn’t always clear before invoking the editor’s built-in shortcuts which one it’s going to select. With the method I’ve devised here, it’s always clear which macro I’m going to edit

Admittedly these are far from big problems in the large scheme of things, but isn’t shaving off finicky points of friction what automation is all about? :wink:

1 Like

The last run macro is in the KM Engine Log file.
See this macro as an example of how to get it:
MACRO: [KM] Display Macro Error

Does NOT require the KM Editor app to be open.

Thanks for sharing that macro, and that fact about the KM Engine log file! I must have missed it when I searched the forum for precedent. However, I did come across other macros, including @DanThomas’s great “Get Recently Run Macros” macro, and tried creating my own that made use of the JavaScript he used to get the list (on a side note, @DanThomas, if you’re reading this, I hope you decide to swing by the forum again sometime; I would love to see what you come up with using KM8’s new scriptability). It worked, but the problem was that, at least with my macros, which include some that activate automatically when switching apps etc., I could never be certain that the most recently run macro, or even the second or third last run macro, would consistently be the particular macro I wanted to edit. As I said above, with this workaround, I always know which macro I’ll be editing, so it’s turning out to be the superior solution (again, at least for me).

Of course, this is all just a holdover until @peternlewis implements read-your-mind triggers for KM10 and we no longer have to tell our Macs what we want to do manually :wink:

1 Like

did you see this macro by @DanThomas, which I believe is the same or similar as yours:
MACRO: Go To Macro by Name (Spotlight)

While I have Dan's macro, most of the time I just use the KM built-in macro search/find: ⌘⌥F

With it, you have a number of search qualifiers you can use:
Search Qualifiers/Filters (KM Wiki)

I have come across that macro before, yes, though admittedly not while researching this one, but had never installed it before. Dan's macro is, unsurprisingly, very elegant and capable, and being able to actually search for the macro you want to edit, complete with filtered results, is great, but since you have to search from scratch every time you invoke it, it still doesn't scratch my particular itch quite as well as my own hack, which saves the current search and thus lets you get back to any given macro with a single hotkey followed by Enter.

I do make use of this search function sometimes (though I often forget about those qualifiers, so thanks for the reminder!) but as I said above, like with the built-in shortcuts for the last used and edited macros inside the editor, the downside is that you have to already have the editor as your frontmost application, which is a step removed when editing a macro for use in different applications. Clearly all these different options have their own trade-offs and advantages, so it's great that we have so many to choose from!

FYI, I do read messages I’m tagged in. I get emails for them, so I’m keeping somewhat of an eye here.

Unfortunately, getting my YouTube channel “The Newbie Woodworker” going is proving to be more of a challenge than I thought it would. So I probably won’t be able to dive into KM8 for a while.

But rest assured, I haven’t forgotten about all you guys (and gals). And I appreciate it when people say nice things about me and the work I’ve done. It helps - especially when I have to re-shoot the same scene 10 times to get what I want, and even then… but I digress.



Are you scriptable? Then we could write a macro for that… :grin:


LOL. I know you’re joking, but the script is part of the problem. I can’t memorize anything to save my life! I have one clip where I took literally 15 minutes to say 30 seconds worth of words.

Needless to say, I use voiceovers wherever possible. :wink:

So, yes, I wish I could script myself! :slight_smile:


[quote=“DanThomas, post:10, topic:8043”]
but the script is part of the problem. I can’t memorize anything to save my life! I have one clip where I took literally 15 minutes to say 30 seconds worth of words.[/quote]

Please post an example video that shows how exactly the script is failing! :blush:


I *knew I shouldn’t have replied! Leave me alone!! :smile:

Believe me, there’s not enough storage space on the server to hold the videos of all my mistakes.



1 Like

There is a reason I used an automated voice for my v8 videos. Man, if you think people don’t like you stumbling over a word here and there, they really don’t like automated voices :wink:


Good to see you again, @DanThomas. Just subscribed to your channel. Enjoy yourself, whatever you’re working on :sunglasses:


Wood it is. I think. Nothing real :wink:

1 Like