[Python] Can pyautogui be used to prevent windows screen lock?

Discussão em 'Python' iniciado por Stack, Junho 1, 2025.

  1. Stack

    Stack Membro Participativo

    I tried to use this script to prevent windows screen lock. The script works for moving the mouse, but it doesn't prevent windows 10 from locking.

    import pyautogui
    import time
    import win32gui, win32con
    import os

    Minimize = win32gui.GetForegroundWindow()
    win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE)

    x = 1

    while x == 1:
    pyautogui.moveRel(1)
    pyautogui.moveRel(-1)
    time.sleep (300)

    Continue reading...

Compartilhe esta Página