Skip to content

Instantly share code, notes, and snippets.

@EdmundMartin
Created November 9, 2021 07:49
Show Gist options
  • Save EdmundMartin/83e8a16d89dc2cf087eeefe98cb103f9 to your computer and use it in GitHub Desktop.
Save EdmundMartin/83e8a16d89dc2cf087eeefe98cb103f9 to your computer and use it in GitHub Desktop.
from pynput.mouse import Controller
import time
import random
mouse = Controller()
positions = [
(5, 5),
(100, 100),
(200, 200),
(300, 300),
(400, 400),
(500, 500),
(600, 600)
]
def sleep_tracker(running_count: int, sleep: int = 15) -> int:
time.sleep(sleep)
return running_count + sleep
def move_until_time_up(minutes: int) -> None :
total_seconds = minutes * 60
running_count = 0
while running_count < total_seconds:
mouse.position = random.choice(positions)
running_count = sleep_tracker(running_count)
if __name__ == '__main__':
move_until_time_up(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment