File size: 1,140 Bytes
4f3dcb6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 time
import random

# Define a function to move the mouse in a random direction for a random length
def move_mouse():
    while True:
        # Get the current mouse position
        x, y = pyautogui.position()
        
        # Generate a random length between 1 and 100
        length = random.randint(1, 100)
        
        # Generate a random direction
        direction = random.choice(['up', 'down', 'left', 'right'])
        
        # Move the mouse in the chosen direction
        if direction == 'up':
            y -= length
        elif direction == 'down':
            y += length
        elif direction == 'left':
            x -= length
        else:  # direction == 'right'
            x += length
        
        # Generate a random duration between 0.1 and 1 second
        duration = random.uniform(0.1, 1)
        
        # Move the mouse to the new position
        pyautogui.moveTo(x, y, duration=duration)
        print(f"Moved the mouse {length} pixels {direction} in {duration} seconds.")
        
        # Wait for 20 seconds
        time.sleep(20)

# Call the function
move_mouse()