Jiggler Mouse
Have your mouse go on an adventure around the screen. NOTE: To stop, hit the f11 key; it will also stop if it reaches the edge of the screen.
import pyautogui
import random
import time
import keyboard
try:
while True:
# Check if F11 is pressed to exit
if keyboard.is_pressed('F11'):
print("F11 key pressed. Exiting.")
break
# Move the mouse cursor randomly
x_offset = random.randint(-250, 250)
y_offset = random.randint(-250, 250)
try:
pyautogui.moveRel(x_offset, y_offset, duration=0.25)
except pyautogui.FailSafeException:
print("Mouse movement failed or reached screen edge. Exiting.")
break
time.sleep(0.1)
except ImportError as e:
print(f"An error occurred: {str(e)}. Please ensure 'pyautogui' and 'keyboard' are installed.")
Last updated