Created
October 12, 2020 16:49
-
-
Save ppartarr/80eef4ae97e50c28cb255a7f38dfb865 to your computer and use it in GitHub Desktop.
Arbitrarily move the mouse to a random location on screen
This file contains hidden or 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
import win32api | |
import time | |
import random | |
import logging | |
# 1920x1080 resolution | |
xLow = 0 | |
xHigh = 1920 | |
yLow = 0 | |
yHigh = 1080 | |
logging.basicConfig(filename="moveMouse.log", level=logging.DEBUG) | |
try: | |
print("Starting move mouse...") | |
while True: | |
x = random.randint(xLow, xHigh) | |
y = random.randint(yLow, yHigh) | |
print("move mouse to x: {0}, y: {1}".format(x, y)) | |
win32api.SetCursorPos((x, y)) | |
# sleep for 5 min | |
time.sleep(300) | |
except Exception as e: | |
logging.info(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment