How to Generate a Text List of all Actions in a Macro

I know I've seen an answer to this question, I may have even asked it before, but right now all my searching in the Forum is coming up empty.

I want to add a "How This Works" comment to the beginning of a macro to explain the Hows and Whys of what I'm doing in it. A starting point would be a simple text list of the titles of all the actions in the macro.


So far my only way of generating that list is to collapse all the actions and then do OCR on a captured image of the macro titles. There has to be a better way.

Right-clicking on an individual action has an option to "Copy as Text", but that provides too much detail and it's one action at a time. For the whole macro, I have not found the equivalent export/save/share/copy format option.

I recall seeing such a thing, possibly even using it once, but I cannot find that use among my own macros now.

Also, I recall a comment, possibly in the same thread, that one should not have extensive comment documentation in the macros themselves because that makes the macro definition file unnecessarily large and therefore slower to update while editing.

Does anyone have any tricks for including a link in a comment to an external documentation file, such as a TextEdit RTF file, so that you could have that link in the macro and just click on it to see the doc for that macroand update it as the macro is developed?

So that's two questions:

  • How to generate a list of a macro's actions?
  • How to link to an external documentation file and easily open it from the KBM editor?

Here's one way to get a textual representation of your macro:

View > Stop Editing Macros

Then select, copy, paste.

I don't know about the file link thing I'm afraid.

1 Like

This worked fine for me. (I replaced my real username with "username" in this image.)

I tried this, but clicking the link didn't open the document; it revealed it. We're also limited to html. Would be nice to have other options (pdf, rtf etc).

True. It didn't occur to me that an extra double click wasn't acceptable.

Wouldn't there be a way for KM to trigger on the fact that a new Finder window opened and then open the selected file?

One solution might be to create a disabled group at the start of the macro:

  • Open the documentation
  • Cancel this macro

Label the group "Enable to show documentation" and collapse it.

Are you thinking of keeping the doc in that disabled group? I'm not sure, but it's been my presumption that whether or not macros and groups are disabled does not affect the size of the macro file, and thus has little influence on how long it takes to write out the file with each incremental change. Thus disabling macros will not speed up the Editor when it becomes sluggish. That is my purpose in getting the doc into a separate file, especially when it's lengthy.

I was thinking something along the lines of...

Maybe an AppleScript Observer could be created to watch for that folder being opened.

KBM does have a trigger for when a file is added or removed from a watched folder and there are several other products that do the same thing, trigger an action when a file is added or removed from a watched folder.

Perhaps there could be a Master Doc folder, and a separate Open Doc folder. The Read Remote Doc action wcould LINK the Master Doc file to the Open Doc folder, which would add a file to that folder without actually creating a "new" file, just a new pointer to the contents.

When triggered, %TriggerValue% is the name of the found new file, so that could be immediately editable. By making it a LINK a link instead of a copy, that would allow changes in the Open Doc file to be automatically included in the Master Doc file.

That's a little convoluted, but doable. How would it work in the KBM UI while actually editing the macro? You want it to be a Comment, as far as macro execution is concerned, and yet you want it to actually do things when you want to see the doc.

Are there any KBM Tokens that identify the macro currently being EDITED in the KBM Editor? Is that accessible through AppleScript? If so, then there would be no need to make any changes in the macro that is being edited, maybe only a comment that says, "This Macro is documented in the file xxxxxxx; press the ⌘⇧K hotkey to open it in a separate editor." Then pressing the hotkey would identify the macro currently open in the editor and open the corresponding doc. But I don't know if that aspect of the Editor is exposed anywhere.

Why not just include the documentation in the forum post when you release the macro? Then you can link to that in the comment.

I did read your posts more than once, but I don't understand whose "files" you are trying to create links for. In my first post, I was assuming this was just for you, yourself, and so I used the "file://" protocol. But now it sounds like you want this feature to work for other people too, but as we know they don't have access to your file system, which probably means I don't understand what you are trying to do. But maybe noisneil knows, so let's see what he can say to help.

1 Like

I had the same thought as you, and presumed there might be some kind of downloadable packaged to accompany the macro, as I've seen that a few times; resources etc.

I do think linking to the forum is the simplest solution, and it's what most people do when they want the user to refer to helpful info that pertains to a macro.

The other day I managed to do that (ie, "linking to the forum") in my OCR speed test macro, using a button, where I created a link in the macro that brought the user to the web page where the macro was uploaded to. Maybe that approach might work. I had never seen anyone do that before I did it.

In order to do that I had to modify my macro after I had created the web page, because I needed the link to the web page. It was kinda a chicken and egg problem.

1 Like

When/if it's published, that would be fine. But what I'm looking for is documenting my development process for myself, while it's a work in progress.

Yes, and that may indeed be the simplest way for me to proceed.

I'm not sure what gave you that idea, other than the way that I am my own audience when I come back to work on or enhance a macro after being away from it for a while.

At the moment, the only sharable or publishable aspect of this is the documentation support macro/scheme/whatever itself.

1 Like

In that case August send yourself a private message containing your documentation; you can then link to its URL in the usual way, but only you will be able to access it. If later on you wish to make it public you can copy its content into a normal forum posting.

Use this macro:
Download Macro(s): Get Macro Actions Name Info.kmmacros (5.6 KB)


Keyboard Maestro Export

  • 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.
    • The macro parent group is "[Test]".
System Information
  • macOS 13.6.1
  • Keyboard Maestro v11.0.1

LOL! I'm not sure what problem you're solving here, but I'm pretty sure that to find an even longer way I'd have to go around the neighbor's barn too.

My apologies for not being clearer in my statement of the problem. I'm looking for an easy way to link to working doc that I use to keep track of the various layers, problem threads, and open questions in the process of developing a complex macro that includes what I hope will be a smooth and fast user interface. When I have an idea or a question, I want to get it written down right away, and if that's in an outside doc, then I want to be able to link back and forth from the macro to the doc and from the doc to the macro, if not in live links, then at least in an organized outline form that matches between the two forms.

My KBM editor is getting slow and sometimes misses characters that I type. I've read that I need to reduce the size of the macro file. A lot of my own macros have pretty verbose comments in them and I've thought that maybe I could put most of that into separate files, but still have it accessible when I need ot maintain or simply re-understand the workings of a macro. This is for me keeping track of my problem solving and development process, not (yet) intended as something for others to use. That's a whole 'nother problem.

THAT'S what I was trying to remember. That's what I remember using before.

I guess it's not intuitive to me (yet) that the Editor has a Stop Editing mode.

COOL! I'll try it.

On skimming it, it looks like it produces just a list of titles, while the "Stop Editing" method shows all the various settings too. So this may well come closer to my "Minimize all Actions and do OCR on an Image" technique.

Nothing more, nothing less - as per the title of your OP.