Move Mouse Cursor using Python

Move Mouse Cursor using Python

Table of contents

No heading

No headings in the article.

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()))