-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulate_mouse.py
More file actions
40 lines (29 loc) · 1.26 KB
/
Copy pathsimulate_mouse.py
File metadata and controls
40 lines (29 loc) · 1.26 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
31
32
33
34
35
36
37
38
39
40
import pyautogui
import random
import time
# defines the duration it should take to move mouse from a to b -> Gets choosen randomly between the min and max value
duration_range = (1, 10)
# defines the min/max duration the script should pause between mouse moves
sleep_range = (5, 100)
# get screen dimensions
display_width, display_height = pyautogui.size()
def simulate_mouse(width=display_width, height=display_height, duration=duration_range, sleep=sleep_range):
"""simulate mouse movement randomly across the screen"""
while True:
# adjust screen - 10% padding
pyautogui.moveTo(random.randint(width*0.1, width*0.9),
random.randint(height*0.1, height*0.9),
random.randint(duration[0], duration[1])/10)
time.sleep(random.randint(sleep[0], sleep[1]))
def simulate_keys_volume(sleep=sleep_range):
"""simulate key presses"""
while True:
# increase volume and then decrease it to get original value
pyautogui.press('volumeup')
time.sleep(1)
pyautogui.press('volumedown')
# make random break until next volume changement
time.sleep(random.randint(sleep[0], sleep[1]))
if __name__ == "__main__":
# simulate_mouse()
simulate_keys_volume()