How to debug a macro?

I wrote a macro to create journal entries in evernote.
Not only does the macro crash (‘macro cancelled’), is also reaps havoc, calling up pages, numbers and Ptouch (labels).
Is there any way to debug the macro, just to see what happens line by line, ie action by action?
thanks very much


Before you trigger your macro, goto the KM Status menu, and select "Start Debugging":

This will show a popup window like this:

Make sure the "Pause New Macros" is CHECKED.

Now trigger your macro.

Your macro will appear in the Debug window.
Click on the icon/button with the DOWN arrow to STEP into the macro to the first step.

Click again to advance another step/Action.

For details, see Keyboard Maestro Debugger


Or write log messages, using something like this:


thank you for your excellent explanation.
Works perfectly using the debugging window step by step as per your instructions.
A disaster when I run it in normal mode. I have absolutely no clue why Pages, Numbers, Ptouch labels are activated, and image (?) is pasted.
How would you troubleshoot?
thanks again

Hey Ronald,

Post the macro, so we can look at it.  :sunglasses:


1 Like

Here is the macro.
thanks very much Chris for your time and help
EN Evernote Log Diary Entry.kmmacros (27.7 KB)

Hey Ronald,

Disable all of the actions in the macro editor.

Do this by selecting all of them and using the Keyboard Maestro Editor’s View > Toggle Enable menu command.

Reenable these one-by-one and run the macro.

That way you can see the point where things go south.

Try to use Menu Commands instead of keystrokes where possible – it makes the macro easier to understand and makes unintended side-effects less likely.

Report back If you can’t get things sorted using this methodology, and I (or someone) will help.



Hi, your method is great, and worked perfectly.
It is interesting that I could not make sense of the fact that my whole computer went bananas when I ran the macro: multiple apps were activated, random pastes, etc
Thanks to your suggestion: I found the solution. I had not deactivated the macro group after the first command, and when I entered (text type) the notebook name, each letter in the notebook name triggered a different macro !
thanks again

I had a complex macro running on a program repeatedly where the program was opening and analyzing an individual data file.

Depending on the data, the program would pop up unexpected dialog boxes, which wreaked havoc with my macro. This might occur every 30 or 40 datasets, so the macro would run fine for an hour before something bad would happen!

I ended up setting a screen recording using QuickTime Player, with the debug window open but NOT set to pause at each step.

I could come back later and, if the macro had gone wild, replay the movie to see exactly what the issue was.


WOW !! very smart. I solved my problem but will keep this in mind. Thank you very much !