-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsteadMouse.py
More file actions
40 lines (34 loc) · 1.04 KB
/
insteadMouse.py
File metadata and controls
40 lines (34 loc) · 1.04 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 mouse
import keyboard
# Define the movement step (you can adjust this as needed)
step = 10
# Function to move the mouse cursor
def move_cursor(x, y):
current_x, current_y = mouse.get_position()
mouse.move(current_x + x * step, current_y + y * step)
# Function to handle keyboard inputs
def on_press(event):
if event.name == 'i':
move_cursor(0, -1)
elif event.name == 'k':
move_cursor(0, 1)
elif event.name == 'j':
move_cursor(-1, 0)
elif event.name == 'l':
move_cursor(1, 0)
elif event.name == 'u':
mouse.click()
elif event.name == 'o':
mouse.right_click()
elif event.name == 'y':
mouse.wheel(1)
elif event.name == 'p':
mouse.wheel(-1)
elif event.name == 'h':
mouse.hold()
# printing commands
print("\nMouse Controls:-\n Move I,J,K,L\n Click U,O Hold with H\n Scroll Y,P")
# Register the callback function for key presses
keyboard.on_press(on_press)
# Keep the script running
keyboard.wait('esc')