Created
November 9, 2021 07:49
-
-
Save EdmundMartin/83e8a16d89dc2cf087eeefe98cb103f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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