asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.24k forks source link

Pause the operation of the physical keyboard and the physical mouse when using this library to automatically operate the keyboard and mouse #676

Open wangmings opened 2 years ago

wangmings commented 2 years ago

Pause the operation of the physical keyboard and the physical mouse when using this library to automatically operate the keyboard and mouse

When using this library to automatically operate the keyboard and mouse, the operation of the external physical keyboard and the physical mouse is suspended to prevent the input interference of the external keyboard and the built-in keyboard.

platform:macOS 10.15

How should this problem be solved?

ahinkle commented 1 year ago

Did you find a solution to this?

JayRizzo commented 1 year ago

I don't know that this is possible, in its current development. pyautogui utilitlizes the same "transport Vehicle", think of pyautogui like a tesla, pyautogui being the ai but the keyboard and mouse being the same car.

I don't know that you can easily do this without creating a "Virtual" keyboard and mouse and disabling the physical like a switch. And I don't know that this would ever be desired as this could be catastrophic, but then again I guess this might be a setting in the end like the FAILSAFE. But, I think this repo alone doesn't contain the ability to do this.

Could be useful especially if you were trying to protect a server or computer from user input.

But come to think of if it. you could sort of get this behaviour by doing a for loop and disabling the FAILSAFE. something like this it would not "Stop" user input from the keyboard or mouse, but sure as hell would prevent any successful user interaction from taking place.

Anyway good luck!