How to temporary freeze mouse during macro execution?

reason being during that 100-200ms keyboard macro execution
sometimes I'd move the mouse instinctively
n it'll mess up the macro a tiny bit sometimes
considering it's mostly Mouse Click actions...

basically only macro controls mouse movement during the macro execution
n not actual mouse hand movement...

The mouse works at a very low level, so there's not (as far as I know) a simple way to temporarily disable it. In theory, you might be able to do something with alternative pointer control methods in the Accessibility section of System Settings, but it'd be pretty ugly (if it even worked).

If I were implementing this myself, I'd probably just put an alert onscreen for a second or so that said "remove hand from mouse, macro about to run!" to remind myself to free the mouse. It's low tech, for sure, but incredibly simple to implement.

-rob.

With a quick search in this great forum: lock-mouse-while-macro

-Neo

1 Like

Is it a bluetooth wireless mouse or a wired USB mouse? The solution may depend on your answer.

wired USB mouse

That's too bad, because that might have made the problem easy.

I have the same problem as you, but I solve it a different way. Instead of disabling the mouse, my macros check if the user has moved the mouse in the last second, and if so, my macro waits until the mouse is idle.

The simplest way to do this would be to place this before each Move/Click Mouse action:

The "tink" sound would be to remind you that the macro is on hold until you stop moving the mouse. Sometimes I replace the "think" sound with a spoken action like this:

Another approach I've used is this:

1 Like

Wow I am having this problem too today (with a wired mouse) and found this old thread.

Hope some day there is a feature to do this?

When you say "do this", that could mean several different things....

Do you just want to disable the buttons on the mouse, or actually freeze the motion of the mouse's pointer as well?

Do you have a programmable mouse, or a basic mouse? Are you willing to purchase a programmable mouse to achieve this? (Programmable mice may make this possible.)

Do you want a solution that works even if the user unplugs the mouse and plugs a new one (or the same one) back in, or does the solution have to work for all mice, even if they are disconnected/reconnected?

Is it a problem if the solution also disables the keyboard? Or is that an acceptable side effect?

Would you accept third party software to do this? (There used to be software that did this.)

Why aren't warnings good enough? One of the suggestions above placed big warnings on the screen. Are you just trying to remind yourself that the mouse should not be used, or are you trying to stop others from actually using it? In other words, what is the reason you are trying to disable the mouse?

Yes thank you for the reply!

And yes...exactly!

I have a pallete shortcut that when I press the button, it changes a whole slew of settings in Zoom.

Unfortunately it all has to be done in KM mostly by mouse-window-coordinates, and I sometimes forget that I have my hand on the actual physical hardware mouse when I hit the button, which can unfortunately throw off the macro.

So yes, it would would be great if there was a feature in KM to disable the physical mouse while the macro runs, which is I believe what this whole discussion was about?

Thanks again for the quick attention and reply!

I see... so the problem is that we want to prevent you from accidentally pressing a mouse button. Disabling the mouse isn't the only way to do that. We can also put a big dark pane over the entire screen, which will warn you to stop using the mouse. So, at the beginning of your macro, call the macro containing these actions asynchronously, and I'm sure you will never make a mistake again, because you can't see the screen anymore....

Actually, your macro knows when it is finished its work, so we could use that to cause the above macro to stop, if you want to do that. Personally, I like the mouse at top of screen idea better.

Now that you've got me thinking about it, there's other ways to solve this. Instead of placing a big warning on the screen, we could convert the screen to dark mode, which you can learn to interpret as, "WHOA! ... this means STOP". And then we could have a mechanism to restore to light mode again, perhaps using the method I demonstrated above (ie, placing the mouse at the top of the screen.)

Sure, disabling the mouse would be better, which is why I asked you if you have a programmable mouse. I think we could make it work with a programmable mouse. (You didn't answer.) That's because usually you can set those mice to different profiles. And we could have a profile made for you that disables all the mouse buttons. (Some smart mice brands prohibit the disabling of the primary mouse button, so those brands won't help you.) We could restore the correct profile when we know the process is finished.

Oh wow I LOVE that!

Not only for the solution, but it will be really cool to watch too!

Thanks!

Thanks! It's quite fun to watch. And I think I posted a version a while back that changes the colours from red, to blue, to green. Which was even more "wow."