Move Mouse Cursor using Python
Aman Ulla
1 min read
Table of contents
Ever wanted a code/program that will keep your laptop awake even if you cannot edit the settings on corporate laptops?
Well worry not, I have a small python code that you can run and your laptop will never sleep :)
import pyautogui
import time
import sys
from datetime import datetime
pyautogui.FAILSAFE = False
numMin = None
if ((len(sys.argv)<2) or sys.argv[1].isalpha() or int(sys.argv[1])<1):
numMin = 1
else:
numMin = int(sys.argv[1])
while(True):
x=0
while(x<numMin):
time.sleep(60)
x+=1
for i in range(0,3):
pyautogui.moveTo(0,i*4)
pyautogui.moveTo(1,1)
for i in range(0,3):
pyautogui.press("shift")
print("Movement made at {}".format(datetime.now().time()))
10
Subscribe to my newsletter
Read articles from Aman Ulla directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Aman Ulla
Aman Ulla
AI Engineer | Freelancer | Blogger | Youtuber