Skip to content

Instantly share code, notes, and snippets.

@0xSumitBanik
Created February 9, 2021 10:23
Show Gist options
  • Save 0xSumitBanik/49f1851b001208014d1213d6bbe068cb to your computer and use it in GitHub Desktop.
Save 0xSumitBanik/49f1851b001208014d1213d6bbe068cb to your computer and use it in GitHub Desktop.
Keep your screen always on. Can be used to show your status as available everytime
'''
Usage: To keep your screen always on
How: The mouse pointer moves randomly to any position after 10 seconds
Run python move_cursor.py to execute it
'''
import pyautogui as pg
import random as rd
import time as t
class MoveCursor():
elapsed_time = 0
def __init__(self):
pass
def welcome_screen_text(self):
print("\n *********************************************")
print("\t Keep your status as available \t\t")
print("********************************************* \n")
def get_user_input(self):
mins_to_move = int(input("\n Enter the AFK duration in mins. "))
mins_to_move_in_seconds = mins_to_move*60
return mins_to_move_in_seconds
def generate_random_coords(self,X,y):
X_coord = rd.randint(X,y)
y_coord = rd.randint(X,y)
return X_coord,y_coord
def move_cursor(self):
mins_to_move_in_seconds = self.get_user_input()
while mins_to_move_in_seconds>0:
pg.hotkey('alt','space','x')
X_coord,y_coord = self.generate_random_coords(100,720)
t.sleep(10)
mins_to_move_in_seconds-=10
print(f"Time Remaining {mins_to_move_in_seconds} seconds.")
pg.moveTo(X_coord,y_coord)
if __name__=="__main__":
move = MoveCursor()
move.welcome_screen_text()
move.move_cursor()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment