title: Can pyautogui be used to prevent windows screen lock?
body: <p>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.</p>
  
  <pre><code>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)
  </code></pre>