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

will pyautogui run even if monitor is turned off? #681

Closed JunkyardCat closed 1 year ago

JunkyardCat commented 2 years ago

will it still run? or will it die auto turn itself off later on?

InfamousPlatypus commented 2 years ago

I believe it runs until the computer falls asleep.

JayRizzo commented 2 years ago

Hi All!

Do NOT FORCE LOCK your Computer

  1. If you have it typing, I have seen odd behaviour where if you lock the screen while a script is running in the background clicking & typing. You Might not be able to unlock it until the script finishes. and may be typing things as your password instead.

Sleep

  1. My computer will not goto sleep if you have it moving the mouse.

Unexpected New Active Window(s)

  1. If you have it clicking on a screen and a new window become active & or pulls to the front, it will start clicking/typing on that instead.
    1. Example: alt/commnad + tab ing while your scripts are running.
    2. Start a script and a program pops to the front needing your intervention.

Multiple Monitors

  1. You might have unintended consequences, if you have multiple monitors and the Primary window is turned off & is forced to another screen.

Best case it detects the Out of bounds it will cancel itself in one of the loop iterations.

These are all things are items you should test for.

Good Luck!

asweigart commented 1 year ago

Yes, it will work if the monitor is turned off. However, if the computer goes asleep or turns off, it will not work.