How to use this script:
- Copy code from here and paste in any IDE of your choice
- Make sure that you can run a python file
- To stop it press enter on keyboard or "-" in terminal
import pyautogui
import random
import threading
import time
import keyboard
def move_mouse():
screen_width, screen_height = pyautogui.size()
while not stop_event.is_set():
x = random.randint(0, screen_width)
y = random.randint(0, screen_height)
pyautogui.moveTo(x, y, duration=0.5)
time.sleep(5)
def stop_on_key_press():
print("Press - to stop the anti-AFK program...")
keyboard.wait('-')
print("Stopping the anti-AFK program...")
stop_event.set()
stop_event = threading.Event()
pyautogui.FAILSAFE = False
pyautogui.PAUSE = 0
pyautogui.moveTo(1, 1)
move_thread = threading.Thread(target=move_mouse)
move_thread.start()
stop_thread = threading.Thread(target=stop_on_key_press)
stop_thread.start()- Make sure to install the KEYBOARD and AUTOGUI librarys for it to work
pip install pyautogui keyboard