-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyMJ.py
More file actions
30 lines (23 loc) · 1.17 KB
/
pyMJ.py
File metadata and controls
30 lines (23 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import ctypes
import random
import time
# Define the maximum distance that the cursor will move
max_pixels = 5
# Define the minimum and maximum time in seconds that the "jiggle" will last
min_s_jiggle_duration = 0.1
max_s_jiggle_duration = 0.25
# Define the minumum and maximum time in seconds between the end of one "jiggle" and the start of the next
min_s_between_jiggles = 30
max_s_between_jiggles = 120
while True:
# Generate a psudorandom destination for the cursor to move to (relative to the current position)
x = random.randint(0-max_pixels, max_pixels)
y = random.randint(0-max_pixels, max_pixels)
# Make sure the pointer will actually move
if x != 0 and y != 0:
# Pause before the next "Jiggle" using a psudorandom duration
time.sleep(random.randint(min_s_between_jiggles, max_s_between_jiggles))
# Perform the "Jiggle" with a psudorandom duration between movements
ctypes.windll.user32.mouse_event(0x0001, x, y, 0, 0)
time.sleep(round(random.uniform(min_s_jiggle_duration, max_s_jiggle_duration),3))
ctypes.windll.user32.mouse_event(0x0001, 0-x, 0-y, 0, 0)