A small python script to move your mouse, press the shift key, and keep your PC awake when you’re away Uses command line arguments to set the number of minutes between movements and requires Python3 or higher. Default timer is 3 minutes, but can be 1 or more.
I created a screen awake loop code using python. Automation is a term for technology applications where human input is minimized. This includes business process automation (BPA), IT automation, personal applications such as home automation and more.
Install Pyautogui In Python
PyAutoGUI is essentially a Python package that works across Windows, MacOS X and Linux which provides the ability to simulate mouse cursor moves and clicks as well as keyboard button presses.
// for macos pip3 install pyautogui // for windows pip install pyautogui
Doing the same repetitive tasks can be a bit boring. Automating such activities can save us much time and help us to be productive in other areas.
import pyautogui import time while True: print("app is running") pyautogui.press('shift') print("pressing shift") time.sleep(40)
This code will keep your screen awake. Comment If this will work for you or If you getting any error.