-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquick_mouse.ahk
212 lines (173 loc) · 3.4 KB
/
quick_mouse.ahk
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#InstallKeybdHook
; quick_mouse
;
; Reinhardt
; 2022.922.0
global INSERT_MODE := False
global NORMAL_MODE := False
global FAST_MODE := False
global FORCE := 1.8
global RESISTANCE := 0.982
global VELOCITY_X := 0
global VELOCITY_Y := 0
SwitchMode(True)
Accelerate(velocity, pos, neg) {
If (pos == 0 && neg == 0) {
Return 0
}
; Smooth declaration
Else If (pos + neg == 0) {
Return velocity * 0.666
}
; Apply physics /(ㄒoㄒ)/~~
Else {
Return velocity * RESISTANCE + FORCE * (pos + neg)
}
}
MoveCursor() {
LEFT := 0
DOWN := 0
UP := 0
RIGHT := 0
LEFT := LEFT - GetKeyState("a", "P")
DOWN := DOWN + GetKeyState("s", "P")
UP := UP - GetKeyState("w", "P")
RIGHT := RIGHT + GetKeyState("d", "P")
If (NORMAL_MODE == False) {
VELOCITY_X := 0
VELOCITY_Y := 0
SetTimer,, Off
}
VELOCITY_X := Accelerate(VELOCITY_X, LEFT, RIGHT)
VELOCITY_Y := Accelerate(VELOCITY_Y, UP, DOWN)
RestoreDPI:=DllCall("SetThreadDpiAwarenessContext","ptr",-3,"ptr") ; Enable per-monitor DPI awareness
MouseMove, %VELOCITY_X%, %VELOCITY_Y%, 0, R
}
SwitchMode(init=False, normal=False) {
If (init == True) {
NORMAL_MODE := True
INSERT_MODE := False
SetTimer, MoveCursor, 16
} Else {
If (normal == True) {
NORMAL_MODE := True
INSERT_MODE := False
SetTimer, MoveCursor, 16
}
If (normal == False) {
NORMAL_MODE := False
INSERT_MODE := True
Return
}
}
}
EnableFast(fast=False) {
If (fast == True) {
FAST_MODE := True
FORCE := 3.85
RESISTANCE := 1
} Else {
FAST_MODE := False
FORCE := 1.8
RESISTANCE := 0.982
}
Return
}
Drag() {
Click, Down
}
Yank() {
wx := 0
wy := 0
width := 0
WinGetPos,wx,wy,width,,A
center := wx + width - 180
y := wy + 12
MouseMove, center, y
Drag()
}
RightDrag() {
Click, Right, Down
}
MouseLeft() {
Click
}
MouseRight() {
Click, Right
}
MouseMiddle() {
Click, Middle
}
MouseCtrlClick() {
Send, {Ctrl Down}{Click}{Ctrl Up}
}
MonitorLeftEdge() {
mx := 0
CoordMode, Mouse, Screen
MouseGetPos, mx
monitor := (mx // A_ScreenWidth)
return monitor * A_ScreenWidth
}
JumpLeftEdge() {
x := MonitorLeftEdge() + 2
y := 0
CoordMode, Mouse, Screen
MouseGetPos,,y
MouseMove, x,y
}
JumpBottomEdge() {
x := 0
CoordMode, Mouse, Screen
MouseGetPos, x
MouseMove, x,(A_ScreenHeight - 0)
}
JumpTopEdge() {
x := 0
CoordMode, Mouse, Screen
MouseGetPos, x
MouseMove, x,0
}
JumpRightEdge() {
x := MonitorLeftEdge() + A_ScreenWidth - 2
y := 0
CoordMode, Mouse, Screen
MouseGetPos,,y
MouseMove, x,y
}
ScrollUp() {
Click, WheelUp
}
ScrollDown() {
Click, WheelDown
}
ScrollRight() {
Click, WheelRight
}
ScrollLeft() {
Click, WheelLeft
}
+!k:: SwitchMode(False, True)
+!l:: SwitchMode(False, False)
+!o:: EnableFast(True)
+!p:: EnableFast(False)
#If (NORMAL_MODE)
w:: Return
a:: Return
s:: Return
d:: Return
+E:: MouseCtrlClick()
+W:: JumpTopEdge()
+A:: JumpLeftEdge()
+S:: JumpBottomEdge()
+D:: JumpRightEdge()
e:: MouseLeft()
q:: MouseRight()
r:: MouseMiddle()
+Y:: Yank()
n:: Drag()
m:: RightDrag()
i:: ScrollUp()
j:: ScrollLeft()
k:: ScrollDown()
l:: ScrollRight()
b:: Click, Up