Disable Keyboard and Mouse during Macro execution


Is there a way to disable user input when macros are running?

Sometimes I have these huge macros running and I end up forgetting they are still performing actions or a worst case scenario last week my wife’s cat decided sleeping on the keyboard of my macbook during a scheduled macro run.

I use alerts and notifications for reminding me when a macro is about to start or finish and use Pause Until Conditions Met using the IDLE function but it doesn’t prevent me messing something during execution.

I understand that by disabling user input I could no longer panic cancel a macro if something goes wrong.

Any ideas?

Thank you all in advance.


How about just activating the Mac Screen Saver?
I just drag the mouse to the lower left corner to activate. Other options available.
You could probably do this in KM (just guessing)


I use lots of UI actions and if the screen is screen saving or the display is asleep they won’t work.

Thank you for the reply.


Wouldn’t disabling input cause the same problem?

Are you sure that the Screen Saver will stop you apps?
You might find this helpful:
Keep Background Apps Running When You Lock Or Put Your Mac To Sleep



Display a window (maybe use the Custom HTML Prompt?) that says not to touch anything, and keep it displayed (by putting it in a sub-macro and executing the macro asynchronously).


While you are screen saving, screen locked, or screen sleeping, you cannot do UI. You can still run macros (as long as your Mac is not asleep) with non-UI triggers like the Time trigger, and the macros can still do lots of things, but not UI stuff like clicks and keystrokes.


Thanks for the clarification about the Screen Saver, Peter. That is very helpful.


Since Peter has confirmed that using the Screen Saver won’t work, how about this: turn off your KB.

I use a usb wireless KB that has on on/off switch. Turn it off and the cat can’t type. :grinning:


according to https://apple.stackexchange.com/questions/67133/how-to-disable-the-built-in-macbook-keyboard
you can call shell script to do this:

echo 'your admin password' | sudo -S kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext

echo 'your admin password' | sudo -S kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext