How to Debug a Macro That Requires a Specific Mouse Location?

How do I use the debugger when the mouse location is relevant to the macro? For example: I when dragging form "current mouse location" I cannot advance the debugger and expect the macro to work.

Is it possible to advance the debugger using the keyboard?

Instead of manually starting the KM Debugger, you can control it with various Actions. So you could put these into the Macro at the relevant points, perhaps just after the mouse action. See:

Debugger actions

Not that I know of, but having keyboard shortcuts for the Debugger would be very handy, Perhaps @peternlewis will jump in here to clarify/comment.

Thank you! I’ll try adding a breakpoint.

You can use the various Step actions in macros.

Macros that start with a debugger command will not start paused even if that is the setting in the debugger, so you should be able to make hot key macros that step other macros.

I have not been able to find anything in the doc or forum that explains what the macro controls "Step Over", "Step Into", and "Step Out" do. Step over, into, or out of what? The macro? What would that do?

https://wiki.keyboardmaestro.com/manual/Macro_Debugger

  • Step Over the current action, including any subactions.
  • Step In To the current action, stepping in to any included subaction.
  • Step Out Of the current action and any other actions at the same level.
2 Likes

Thanks, "hello".

But what does any of that DO? You are answering my question with the same terms that I am asking to be defined. I'm sure it will all make sense when I finally understand it, but it's a foreign language at this point.

What IS "stepping over an action"? What am I "stepping over" and where do I go from where I am? How does any of that apply to "If Then" actions and Groups?

Does it skip the actions, or execute through them until the next debugging interruption to make a similar decision?

I have a linear sequence of actions. What does it mean to "step out of" the current current action? If there is only a linear sequence, with no loops or branches, does "stepping out of" the action exit the entire macro?

What does it mean to "step into" an action? Presumably the actions, groups, branches, loops, whatever, are being executed in the way that they are written to be executed. Where is INTO? Into what?

I appear to be missing key concepts of what the Debugger is actually doing and how I interact with it and I cannot find explanations anywhere. It took me 20 minutes of searching just to find names for what the buttons are, but the names are no help. It would be lovely if there was a tutorial, but I haven't found it yet.

I'll keep trying...

Thanks.

In a classic case of "Where's my ... HERE it is!", I just found this thread:

I'll read through that, watch the video, etc. and see what I can figure out.

Hey @August,

There's just a few actions related to debugging:

image

I'm about ready do make a debugging palette that when active allows single-key access to:

image

  1. Resume
  2. Pause
  3. Next
  4. Step Into
  5. Step Out Of

The action macro will turn debugging ON and open the single-key debugging-actions palette. (I detest clicking through these kinds of things with the mouse.)

Hey @peternlewis – I really wish the Highlighted Action in the Editor would follow along with the Debugger. I also really wish there was a toggleable option to Highlight Failed Action on Exception.

-Chris

1 Like

There is a complete disconnect between the macro shown in the editor and the macro run in the engine, so this sort of close integration is impossible without a completely different design to Keyboard Maestro.

Well drat! :rage:

@peternlewis, you may want to look at my macro Display Last KM Macro Error Ver 4 [Pub].
It is a running macro (obviously) that connects to a specific macro in the KM Editor.
I'm pretty sure if it can be done with AppleScript you could do it with ObjC.

@ccstone did you ever make that palette? I'd love a copy of it please.

Nope... :sunglasses:

Those actions are all readily available in the Action-Inspector-Panel (Cmd-K):

image

You can just make up a single-key hotkey palette that toggles on/off with a more complex hotkey trigger.

Here's one that I use all the time:

image

Holler if you have problems figuring this out.

-Chris