Debugger Preference Request

Who can remember the name of all their macros?.... hands up?.... right. =)

I am constantly turning on the debugger with a macro, ok, nice.
And then invoking the trigger of the macro I'm wanting to work on.
That macro then shows up in the debugger and I have to then click on the pencil to edit the macro, then click on the x's to the right of the macro(s) and then x to close the window.
Only then can I continue to work on the macro I was looking for in the editor.

It would be great to have a pref within the debugger that was 'edit next macro triggered'.
So when I invoked the debugger, all I would have to do is trigger the macro and I would be in the KM editor at work without having to do any clicks to close the paused macro(s)/debugger.

This would automatically 'stop' all paused macros and close the debugger window and leave me in the editor.

There's probably another solution that I am not aware of.

I appreciate any input/feedback.

Do you want to bypass the debugger entirely and simply open the last used macro?

The Keyboard Maestro Editor has a menu item for this: View → Select Macro → Last Used
As well as a keyboard shortcut: ⌥+⌘+U

1 Like

Thanx @avtraino .

No, i don’t want to have to run the macro first.
It may be that theres a problem with it. Or it may be extremely long…

I want to get it in the editor and edit it first.

Here’s a rudimentary AppleScript that in my limited testing does what you want. However, if you execute it from KM, you may or may not run into issues where the Debugger pauses it and doesn’t allow even it to proceed.

See my post below for another macro I was working on that interacts with the Debugger window for more info on some issues I was running into.

Toggling Debugger Window via Applescript, Macro Will Not Proceed After Window Is Open - Questions & Suggestions - Keyboard Maestro Discourse

AppleScript (click to expand/collapse)
set theWindow to "Keyboard Maestro Debugger"
set delayInteger to 0.2
tell application "System Events"
	tell application process "Keyboard Maestro Engine"
		
		# wait for Debugger window to open
		repeat until exists window theWindow
			delay delayInteger
		end repeat
		
		tell window theWindow
			
			# wait for pause checkbox to appear
			repeat until exists checkbox 1
				delay delayInteger
			end repeat
			
			# click to pause macros			
			click checkbox 1
			
			# wait until the next macro appears in the Debugger window
			repeat until exists button 2 of group 1 of scroll area 1
				delay delayInteger
			end repeat
			
			# click to edit the macro
			click button 2 of group 1 of scroll area 1
			delay delayInteger
			
			# click to cancel the macro
			click button 1 of group 1 of scroll area 1
			delay delayInteger
			
			# click to close the Debugger window
			click button 1
			
		end tell
	end tell
end tell

I just gave it a quick try.
After triggering the applescript, as soon as the debugger window opens, it closes.
The 'debugger' 'line item' with it's checkbox seems to be satisfying a applescript and it closes.
I tried altering the number of the checkbox,,,, etc etc... to no avail.

I don't get a chance to trigger the macro that I want to investigate.

I've made some progess with editing the applescript.
I'll be able to spend more time later. I think it should be able to modified to work as I'd like, I'll post ...

Thank you @cdthomer for this, good stuff.

Still open to any others that have input....

This works for me, thank you @cdthomer , I made a mistake the other day with your original and thought it didn't work but it does.
I modified it a bit to cancel up to 4 macros if they were triggered with the main one.

set theWindow to "Keyboard Maestro Debugger"
set delayInteger to 0.2
tell application "System Events"
	tell application process "Keyboard Maestro Engine"
		
		# wait for Debugger window to open
		repeat until exists window theWindow
			delay delayInteger
		end repeat
		
		tell window theWindow
			
			# wait for pause checkbox to appear
			repeat until exists checkbox 1
				delay delayInteger
			end repeat
			
			# click to pause macros			
			--click checkbox 1
			
			# wait until the next macro appears in the Debugger window
			repeat until exists button 2 of group 2 of scroll area 1
				delay delayInteger
			end repeat
			
			# click to edit the macro
			click button 2 of group 2 of scroll area 1
			delay delayInteger
			
			try
				click button 1 of group 4 of scroll area 1
				delay delayInteger
			end try
			
			try
				click button 1 of group 3 of scroll area 1
				delay delayInteger
			end try
			
			try
				click button 1 of group 2 of scroll area 1
				delay delayInteger
			end try
			
			# click to cancel the macro
			click button 1 of group 1 of scroll area 1
			delay delayInteger
			
			# click to close the Debugger window
			click button 1
			
		end tell
	end tell
end tell

How can I open the debugger in 'pause' mode and also trigger the applescript in one step?

Also while running the applescript in script editor it does successfully close the debugger window.
When I run the applescript as an action it does not close the debugger window.

Hey Troy, glad you got it mostly working.

I’m not sure of your specific issue, but it might be related to the one I mentioned in the topic I linked to earlier. Basically I have to run the AppleScript as an applet instead of a KM action. Read through my posts in that topic as they might shed some light on your situation.

If that ends up not being the issue, I’ll try to take a look at it this weekend.

1 Like