Skip to content

Instantly share code, notes, and snippets.

@ranelpadon
Created September 22, 2022 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranelpadon/c2f6f37cdb809e64b4594deb4a8af104 to your computer and use it in GitHub Desktop.
Save ranelpadon/c2f6f37cdb809e64b4594deb4a8af104 to your computer and use it in GitHub Desktop.
Simple script to move the mouse cursor randomly and indefinitely. This will make your status stay "Online" in various apps.
"""
Requires `pip install pyautogui`.
"""
import pyautogui
import random
import time
# Get the screen boundaries.
screen_width, screen_height = pyautogui.size()
print('Screen width: {}'.format(screen_width))
print('Screen height: {}'.format(screen_height))
# Run forever unless terminated.
while True:
# Move the mouse cursor to a new, random location within the screen.
new_x = random.randrange(screen_width)
new_y = random.randrange(screen_height)
print('Moving cursor to ({}, {})'.format(new_x, new_y))
pyautogui.moveTo(new_x, new_y)
# Wait 60 seconds before moving the cursor again.
time.sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment