TIP: Using Rename to document your macro

I'm sure this has already been covered, but a search came up empty.

Renaming macro steps is an excellent way to make them more readable. A side benefit is that you can quickly find which step caused KM to end execution, as the notification mentions which step was the issue.

Here's an example of a script that creates a Due reminder at 12:30 PM today or tomorrow, depending on the current time.

If you open a step, you can see the substeps, also renamed for clarity:

I hope this helps! This technique shines particularly for very long and involved macros. I didn't learn about it until several years after starting to use KM. For me this practice costs far less time than it saves.

2 Likes

Yes indeed!

One can also group actions, and then, of course, name the group appropriately. I actually prefer to do that, leaving the action names unaltered. Sometimes that even means that I have just one action in a group–but that‘s allowed! :wink:

Readability of long macros can also be much improved by giving different colours to actions or groups of actions.

For anyone who may need to know: you will find these features of the editor under the cogwheel of an action or under “Actions” in the menu bar.

1 Like

Absolutly and so glad that Peter added the group years back. I rememer grouping things in a repeat with no repeat just to do that.

I haven't quite got a system down for the colors yet. Not much has dawned on me of how to best use that other than what to change if I need to update it.

I do love when people upload macros and have them all color coded with a legend that shows what colors to pay attention to in particular. It makes diving into long macros much faster. Also when people do groups and have macros just for names to see the order of things.

Dated comments as well have certainly helped me with knowing when I came up with something. Sometimes I forget I just did that a month ago and almost delete a macro thinking it is old and then take time to figure out since it probably still works and I came up with it for some reason for the software I am in.

Absolutly and something that I had overlooked for years.

2 Likes

I reserve red for anything that I need to improve or fix. Otherwise, I use any colour (or absence of colour) that will provide visual contrast.

Yes, and that can sometimes also provide a sloppy but adequate kind of version control for a macro.

1 Like