STUCK IN A LOOP - Launch KM Editor Only and/or Kill Switch

Hi -

I have a vicious accidental timed loop started and I need to only launch the KM editor to kill the command outright OR a general kill switch on KM. Or any other ideas how to get out of an accidental 1 second periodic loop - thanks for the help.

Boot to safe mode (Presumably the km engine will not run in safe mode) and edit the macro in the editor?

I’ve suffered from similar issues before. The most convenient solution is to make an apple script (with hotkeys) to quit the km engine.

1 Like

You can just run the KM Editor and kill KM Engine in activity window (KM editor can remain open). Make change in the editor and then restart KM.
image

1 Like

Thanks but there doesn't seem to be time to get to that - once km starts it immediately starts the loop.

Safe mode works to stop the loop finally but I can't get into KM without the 1 second loop taking over - that's why trying just to load the editor - useless once the engine going but with just the editor I could delete that macro.

Thx for the input.

JBG_km,
I just curious. What's your loop do that prevent KM Editor from editing the macro to fix the issue ?

You can also run the following in terminal, or put them in bash file.
open -a "Keyboard Maestro"
pkill -f "Keyboard Maestro Engine"

Mouse clicking - argh!! So I can't click anything within that second loop - I tried denying KM access to the folders in system prefs to give me a chance to delete the macro but didn't work.

Thanks for the advice

Hi @macdevign_mac,

Ah. I forgot the engine will also launch when you start the editor.

Can you make the following AppleScript to trigger by hotkey?

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2018/04/20 09:54
# dMod: 2018/04/20 09:55
# Appl: Keyboard Maestro Engine
# Task: Quit and restart the Keyboard Maestro Engine
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Quit, @Restart, @Keyboard_Maestro_Engine, @Engine
----------------------------------------------------------------

tell application id "com.stairways.keyboardmaestro.engine"
   if running then
      quit
   else
      launch
   end if
end tell

For instance, I have Alfred, and I made a workflow to be triggered by hotkey:
image

In the script, I put the above code to it:

I also remapped the Caps lock key into the hyper key. So, by pressing the "hyper key + K", I'm able to toggle the Engine state between running and quit.

If you don't have Alfred (requiring the powerpack), You may use other means.

FastScripts 3 allows you to run a few scripts for free, I believe.

Will that kill the engine but keep the editor? Is there any other way to do as not sure I will be able to trigger the hotkey fast enough. I really need some way to get just the engine to start. The added crushing blow is I have to do about a 5 min safe boot everytime I try sthing that doesn't work.

Yes.

I think it is ok even if the engine has already triggered the macro, since quitting the engine will also cancel the macro. So I guess it's ok for it to loop for a few seconds.

1 Like

Thanks so much for the help. I was in the middle of trying your macro & did something else that worked!

I'm posting what worked for me in case anyone else gets in this terrible situation:

Go to Security & Privacy & turn off the engines access in Accessibility - you can then launch KM - make sure you deny any requests for access to anything by KM - then kill your macro.

I had gone into Privacy before but only disabled folders, not Accessibility.

Anyway, thanks again!

I'm glad you've found another way to do it.

The AppleScript (created by @ccstone) I posted above is still helpful. It is very useful for quickly quitting/launching the engine.I've used it many times.

Great - I have that script as a Plan B now.

This is my 2nd loop terror - super scary. The last one I had KM starting with startup and that was an added layer of terror - at least now I don't have that to fight as well.

Thx again.

Martin, JBG_km,

I have tested this and this will work. (Even attempting the same mouse situation as JBG)
image
[EXP] Run KM Editor Only.kmmacros (2.3 KB)
It utilizes the background process command & (without which, the macro will not work)
To explain:
When KM engine startup, pressing the shortcut key will open KM Editor after which it run KM Editor and quit the engine after 7 seconds. So this handle the chicken-and-egg problem, regardless of whether the engine is started first, or KM Editor is started follow by KM Engine.

Let me know if this works for you.

1 Like

Awesome - thx for another solution. Will try later.

KM could have added OPT+Click on KM Icon in dock to launch KM Editor without running the engine (much like Firefox ) but I guess this type of situation happening is rare so probably not justify adding such support.

Hi @macdevign_mac,

Your macro only works when the KM Engine is already running. It's ok if you just want to quit the engine, but if you would like to launch it as well, then it won't launch because when the engine is quit, no macros will run. That's why I recommended above to use external trigger such as Alfred or FastScripts.

Martin,
the macro is meant to solve the issue when the engine is preventing KM Editor from being used, whether it is started first , or started by KM Editor, though shortcut key using only KM without replying on another helper full-featured app like Alfred/FastScripts, since some users may not like to install additional apps.

But if users need to toggle KM Engine usage, your solution is more appropriate..

Another lightweight approach is to use Automator to create a simple app file calling the KM engine . This can then be pinned to the dock and use for restart/toggle the engine.

1 Like

Martin, JBG,

turn out that KM has already added this feature

1 Like

Look like I need to read the excellent KM wiki more often and closely :}