Cant debug this..macro runs reliably from test but gives an error from the conflict panel

Hi all

i have this rather long macro (appologies in advance if its crude and messy its the best can do with my pathetic programming skills haha)

this works 100% of the time when i launch it via the try button, yet always fails when either launched via a conflict panel or even with the trigger macto by name that is system wide. this is the error i see in the log

2025-03-29 13:23:36 Action 16825950 timeout exceeded. Macro “22)s.z (shop amazon work)” cancelled (while executing Copy).

How does one go about debugging this, im clueless

thx so much!

Z

PS any comments on the macro itself also appreciated, i know i probably over complicated it hahah

Well, thanks for being open to suggestions. My first suggestion is that all of your Cancel actions seem to do nothing, because none of them is/are followed by any further actions. Secondly, you are using a bunch of nested IF actions. While there's nothing functionally wrong with that, it can be harder to read IFs than when using the Switch action, which might look like this in your case:

image

The best way to debug anything is to use the KM Debugger. It's available from the KM icon in the menu bar by clicking on "Start Debugging." Perhaps in your macro you should open the debugger using this action:

image

This will start the debugger and pause your macro. Then in that debugger window it's very helpful to turn on the variable option to look like this: (a grey background, not black)

image

Then once you reach this point, press the "Step" button once, and examine whether the variables that are displayed in that window are precisely what you expect them to be. Here's what the step button looks like:

image

This is how I debug. Most of the time I'm able to figure out what's wrong by manually validating every variable after every step is taken.

If you upload your macro, we may be able to debug it for you, but I highly recommend that you try it yourself first.

Wow just wow @Airy , This maybe the most imporant post i have ever gone through!

both the switch and the debugging macro are incredible and even though i have been using keyboard maestro for 8 years i have only discovered this now (shows my computational competence haha)

thx you so much!

Z

You made my day. I was actually worried you would be upset at my basic instructions.

Yes, the debugger is critically important to making macros work. I spend perhaps 25% of all my time in KM using the debugger.

1 Like

You can see from the error message that a "Copy" action is timing out -- that's most likely because you don't have something selected (or, perhaps, copyable) in the current context. Unfortunately the "Copy" action isn't showing in your screen shot -- you'll have to dig into your closed groups to work out what the problem might be.

You can go straight to the offending action in the Editor by running the following AppleScript in either a KM action or the Script Editor app:

tell application "Keyboard Maestro"
	selectAction 16825950
end tell
3 Likes