-
Notifications
You must be signed in to change notification settings - Fork 2
/
mouse.ahk
742 lines (672 loc) · 19.4 KB
/
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
/*
o------------------------------------------------------------o
|Using Keyboard Numpad as a Mouse |
(------------------------------------------------------------)
| By deguix/modified by metasog for AutoHotkey 1.0.22+ |
| ----------------------------------------|
| |
| remapping of numpad keys of a keyboard to transform it |
| into a mouse. Some features are the acceleration which |
| enables you to increase the mouse movement when holding |
| a key for a long time, and the rotation which makes the |
| numpad mouse to "turn". I.e. k as i |
| and vice-versa. See the list of keys used below: |
| |
|------------------------------------------------------------|
| Keys | Description |
|------------------------------------------------------------|
| Tab (toggle on) | Activates numpad mouse mode. |
|-----------------------|------------------------------------|
| h | Left mouse button click. |
| , | Middle mouse button click. |
| ; | Right mouse button click. |
| p// | X1/X2 mouse button click. (Win 2k+)|
| y/n | Moves up/down the mouse wheel. |
| | |
|-----------------------|------------------------------------|
|-----------------------|------------------------------------|
| u/i/o/ | Mouse movement. |
| j/k/l/ | |
| m/</> | |
| | |
|-----------------------|------------------------------------|
|-----------------------|------------------------------------|
| w/x | Inc./dec. acceleration per |
| | button press. |
| e/c | Inc./dec. initial speed per |
| | button press. |
| r/v | Inc./dec. maximum speed per |
| | button press. |
| !w/!x | Inc./dec. wheel acceleration per |
| | button press*. |
| !e/!c | Inc./dec. wheel initial speed per |
| | button press*. |
| !r/!v | Inc./dec. wheel maximum speed per |
| | button press*. |
| s/f | Inc./dec. rotation angle to |
| | right in degrees. (i.e. 180° = |
| | = inversed controls). |
|------------------------------------------------------------|
| * = These options are affected by the mouse wheel speed |
| adjusted on Control Panel. If you don't have a mouse with |
| wheel, the default is 3 +/- lines per option button press. |
o------------------------------------------------------------o
*/
;=============================================================
;START OF CONFIG SECTION
MouseSpeed = 4
MouseAccelerationSpeed = 7
MouseMaxSpeed = 28
;Mouse wheel speed is also set on Control Panel. As that
;will affect the normal mouse behavior, the real speed of
;these three below are times the normal mouse wheel speed.
MouseWheelSpeed = 1
MouseWheelAccelerationSpeed = 1
MouseWheelMaxSpeed = 5
MouseRotationAngle = 0
;END OF CONFIG SECTION
;=============================================================
;This is needed or key presses would faulty send their natural
;actions. Like p would send sometimes "/" to the
;screen.
#InstallKeybdHook
Temp = 0
Temp2 = 0
MouseRotationAnglePart = %MouseRotationAngle%
;Divide by 45º because MouseMove only supports whole numbers,
;and changing the mouse rotation to a number lesser than 45º
;could make strange movements.
;
;For example: 22.5º when pressing i:
; First it would move upwards until the speed
; to the side reaches 1.
MouseRotationAnglePart /= 45
MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%
MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseSpeed%
SetKeyDelay, -1
SetMouseDelay, -1
Hotkey, *h, ButtonLeftClick
Hotkey, *a, ButtonLeftClickIns
Hotkey, *`,, ButtonMiddleClick
Hotkey, *b, ButtonMiddleClickClear
Hotkey, *;, ButtonRightClick
Hotkey, *g, ButtonRightClickDel
Hotkey, *p, ButtonX1Click
Hotkey, */, ButtonX2Click
Hotkey, *y, ButtonWheelUp
Hotkey, *n, ButtonWheelDown
Hotkey, *i, ButtonUp
Hotkey, *k, ButtonDown
Hotkey, *j, ButtonLeft
Hotkey, *l, ButtonRight
Hotkey, *u, ButtonUpLeft
Hotkey, *m, ButtonUpRight
Hotkey, *o, ButtonDownLeft
Hotkey, *., ButtonDownRight
Hotkey, e, ButtonSpeedUp
Hotkey, c, ButtonSpeedDown
Hotkey, w, ButtonAccelerationSpeedUp
Hotkey, x, ButtonAccelerationSpeedDown
Hotkey, r, ButtonMaxSpeedUp
Hotkey, v, ButtonMaxSpeedDown
Hotkey, f, ButtonRotationAngleUp
Hotkey, s, ButtonRotationAngleDown
Hotkey, !e, ButtonWheelSpeedUp
Hotkey, !c, ButtonWheelSpeedDown
Hotkey, !w, ButtonWheelAccelerationSpeedUp
Hotkey, !x, ButtonWheelAccelerationSpeedDown
Hotkey, !r, ButtonWheelMaxSpeedUp
Hotkey, !v, ButtonWheelMaxSpeedDown
ScrollLockState = 0
disableMouseLayer() ; Initialize based on current Tab state.
return
;Key activation support
enableMouseLayer() {
Hotkey, *h, on
Hotkey, *a, on
Hotkey, *`,, on
Hotkey, *b, on
Hotkey, *;, on
Hotkey, *g, on
Hotkey, *p, on
Hotkey, */, on
Hotkey, *y, on
Hotkey, *n, on
Hotkey, *i, on
Hotkey, *k, on
Hotkey, *j, on
Hotkey, *l, on
Hotkey, *u, on
Hotkey, *m, on
Hotkey, *o, on
Hotkey, *., on
Hotkey, e, on
Hotkey, c, on
Hotkey, w, on
Hotkey, x, on
Hotkey, r, on
Hotkey, v, on
Hotkey, f, on
Hotkey, s, on
Hotkey, !e, on
Hotkey, !c, on
Hotkey, !w, on
Hotkey, !x, on
Hotkey, !r, on
Hotkey, !v, on
}
disableMouseLayer() {
Hotkey, *h, off
Hotkey, *a, off
Hotkey, *`,, off
Hotkey, *b, off
Hotkey, *;, off
Hotkey, *g, off
Hotkey, *p, off
Hotkey, */, off
Hotkey, *y, off
Hotkey, *n, off
Hotkey, *i, off
Hotkey, *k, off
Hotkey, *j, off
Hotkey, *l, off
Hotkey, *u, off
Hotkey, *m, off
Hotkey, *o, off
Hotkey, *., off
Hotkey, e, off
Hotkey, c, off
Hotkey, w, off
Hotkey, x, off
Hotkey, r, off
Hotkey, v, off
Hotkey, f, off
Hotkey, s, off
Hotkey, !e, off
Hotkey, !c, off
Hotkey, !w, off
Hotkey, !x, off
Hotkey, !r, off
Hotkey, !v, off
}
CapsLock & Tab::
If ScrollLockState = 1
{
;autohotkey.com/boalllrd/topic/32608-changing-the-system-cursor/
moveMouseToWindowCenter()
TrayTip, Mouse Layer, ENABLE, 1
SetTimer, RemoveTrayTip, 1000
ToolTip, ENABLE Mouse Layer
SetTimer, RemoveToolTip, 1000
ScrollLockState = 0
enableMouseLayer()
}
else
{
TrayTip, Mouse Layer, DISABLE,1
SetTimer, RemoveTrayTip, 1000
ToolTip, DISABLE Mouse Layer
SetTimer, RemoveToolTip, 1000
ScrollLockState = 1
disableMouseLayer()
}
return
;Mouse click support
ButtonLeftClick:
GetKeyState, already_down_state, LButton
If already_down_state = D
return
Button2 = h
ButtonClick = Left
Goto ButtonClickStart
ButtonLeftClickIns:
GetKeyState, already_down_state, LButton
If already_down_state = D
return
Button2 = a
ButtonClick = Left
Goto ButtonClickStart
ButtonMiddleClick:
GetKeyState, already_down_state, MButton
If already_down_state = D
return
Button2 = `,
ButtonClick = Middle
Goto ButtonClickStart
ButtonMiddleClickClear:
GetKeyState, already_down_state, MButton
If already_down_state = D
return
Button2 = NumPadClear
ButtonClick = Middle
Goto ButtonClickStart
ButtonRightClick:
GetKeyState, already_down_state, RButton
If already_down_state = D
return
Button2 = ;
ButtonClick = Right
Goto ButtonClickStart
ButtonRightClickDel:
GetKeyState, already_down_state, RButton
If already_down_state = D
return
Button2 = g
ButtonClick = Right
Goto ButtonClickStart
ButtonX1Click:
GetKeyState, already_down_state, XButton1
If already_down_state = D
return
Button2 = p
ButtonClick = X1
Goto ButtonClickStart
ButtonX2Click:
GetKeyState, already_down_state, XButton2
If already_down_state = D
return
Button2 = /
ButtonClick = X2
Goto ButtonClickStart
ButtonClickStart:
MouseClick, %ButtonClick%,,, 1, 0, D
SetTimer, ButtonClickEnd, 10
return
ButtonClickEnd:
GetKeyState, kclickstate, %Button2%, P
if kclickstate = D
return
SetTimer, ButtonClickEnd, off
MouseClick, %ButtonClick%,,, 1, 0, U
return
;Mouse movement support
ButtonSpeedUp:
MouseSpeed++
ToolTip, Mouse speed: %MouseSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonSpeedDown:
If MouseSpeed > 1
MouseSpeed--
If MouseSpeed = 1
ToolTip, Mouse speed: %MouseSpeed% pixel
else
ToolTip, Mouse speed: %MouseSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonAccelerationSpeedUp:
MouseAccelerationSpeed++
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonAccelerationSpeedDown:
If MouseAccelerationSpeed > 1
MouseAccelerationSpeed--
If MouseAccelerationSpeed = 1
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixel
else
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonMaxSpeedUp:
MouseMaxSpeed++
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonMaxSpeedDown:
If MouseMaxSpeed > 1
MouseMaxSpeed--
If MouseMaxSpeed = 1
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixel
else
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonRotationAngleUp:
MouseRotationAnglePart++
If MouseRotationAnglePart >= 8
MouseRotationAnglePart = 0
MouseRotationAngle = %MouseRotationAnglePart%
MouseRotationAngle *= 45
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
SetTimer, RemoveToolTip, 1000
return
ButtonRotationAngleDown:
MouseRotationAnglePart--
If MouseRotationAnglePart < 0
MouseRotationAnglePart = 7
MouseRotationAngle = %MouseRotationAnglePart%
MouseRotationAngle *= 45
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
SetTimer, RemoveToolTip, 1000
return
ButtonUp:
ButtonDown:
ButtonLeft:
ButtonRight:
ButtonUpLeft:
ButtonUpRight:
ButtonDownLeft:
ButtonDownRight:
If Button <> 0
{
IfNotInString, A_ThisHotkey, %Button%
{
MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%
}
}
StringReplace, Button, A_ThisHotkey, *
ButtonAccelerationStart:
If MouseAccelerationSpeed >= 1
{
If MouseMaxSpeed > %MouseCurrentSpeed%
{
Temp = 0.001
Temp *= %MouseAccelerationSpeed%
MouseCurrentAccelerationSpeed += %Temp%
MouseCurrentSpeed += %MouseCurrentAccelerationSpeed%
}
}
;MouseRotationAngle convertion to speed of button direction
{
MouseCurrentSpeedToDirection = %MouseRotationAngle%
MouseCurrentSpeedToDirection /= 90.0
Temp = %MouseCurrentSpeedToDirection%
if Temp >= 0
{
if Temp < 1
{
MouseCurrentSpeedToDirection = 1
MouseCurrentSpeedToDirection -= %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
if Temp >= 1
{
if Temp < 2
{
MouseCurrentSpeedToDirection = 0
Temp -= 1
MouseCurrentSpeedToDirection -= %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
if Temp >= 2
{
if Temp < 3
{
MouseCurrentSpeedToDirection = -1
Temp -= 2
MouseCurrentSpeedToDirection += %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
if Temp >= 3
{
if Temp < 4
{
MouseCurrentSpeedToDirection = 0
Temp -= 3
MouseCurrentSpeedToDirection += %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
}
EndMouseCurrentSpeedToDirectionCalculation:
;MouseRotationAngle convertion to speed of 90 degrees to right
{
MouseCurrentSpeedToSide = %MouseRotationAngle%
MouseCurrentSpeedToSide /= 90.0
Temp = %MouseCurrentSpeedToSide%
Transform, Temp, mod, %Temp%, 4
if Temp >= 0
{
if Temp < 1
{
MouseCurrentSpeedToSide = 0
MouseCurrentSpeedToSide += %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
if Temp >= 1
{
if Temp < 2
{
MouseCurrentSpeedToSide = 1
Temp -= 1
MouseCurrentSpeedToSide -= %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
if Temp >= 2
{
if Temp < 3
{
MouseCurrentSpeedToSide = 0
Temp -= 2
MouseCurrentSpeedToSide -= %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
if Temp >= 3
{
if Temp < 4
{
MouseCurrentSpeedToSide = -1
Temp -= 3
MouseCurrentSpeedToSide += %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
}
EndMouseCurrentSpeedToSideCalculation:
MouseCurrentSpeedToDirection *= %MouseCurrentSpeed%
MouseCurrentSpeedToSide *= %MouseCurrentSpeed%
Temp = %MouseRotationAnglePart%
Transform, Temp, Mod, %Temp%, 2
If Button = i
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseCurrentSpeedToDirection *= -1
MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R
}
else if Button = k
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseCurrentSpeedToSide *= -1
MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R
}
else if Button = j
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseCurrentSpeedToSide *= -1
MouseCurrentSpeedToDirection *= -1
MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R
}
else if Button = l
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R
}
else if Button = u
{
Temp = %MouseCurrentSpeedToDirection%
Temp -= %MouseCurrentSpeedToSide%
Temp *= -1
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 += %MouseCurrentSpeedToSide%
Temp2 *= -1
MouseMove, %Temp%, %Temp2%, 0, R
}
else if Button = o
{
Temp = %MouseCurrentSpeedToDirection%
Temp += %MouseCurrentSpeedToSide%
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 -= %MouseCurrentSpeedToSide%
Temp2 *= -1
MouseMove, %Temp%, %Temp2%, 0, R
}
else if Button = m
{
Temp = %MouseCurrentSpeedToDirection%
Temp += %MouseCurrentSpeedToSide%
Temp *= -1
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 -= %MouseCurrentSpeedToSide%
MouseMove, %Temp%, %Temp2%, 0, R
}
else if Button = .
{
Temp = %MouseCurrentSpeedToDirection%
Temp -= %MouseCurrentSpeedToSide%
Temp2 *= -1
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 += %MouseCurrentSpeedToSide%
MouseMove, %Temp%, %Temp2%, 0, R
}
SetTimer, ButtonAccelerationEnd, 10
return
ButtonAccelerationEnd:
GetKeyState, kstate, %Button%, P
if kstate = D
Goto ButtonAccelerationStart
SetTimer, ButtonAccelerationEnd, off
MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%
Button = 0
return
;Mouse wheel movement support
ButtonWheelSpeedUp:
MouseWheelSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
MouseWheelSpeedMultiplier = 1
MouseWheelSpeedReal = %MouseWheelSpeed%
MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
MouseWheelSpeedMultiplier = 1
If MouseWheelSpeedReal > %MouseWheelSpeedMultiplier%
{
MouseWheelSpeed--
MouseWheelSpeedReal = %MouseWheelSpeed%
MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelSpeedReal = 1
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% line
else
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelAccelerationSpeedUp:
MouseWheelAccelerationSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
MouseWheelSpeedMultiplier = 1
MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelAccelerationSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
MouseWheelSpeedMultiplier = 1
If MouseWheelAccelerationSpeed > 1
{
MouseWheelAccelerationSpeed--
MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelAccelerationSpeedReal = 1
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% line
else
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelMaxSpeedUp:
MouseWheelMaxSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
MouseWheelSpeedMultiplier = 1
MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelMaxSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier <= 0
MouseWheelSpeedMultiplier = 1
If MouseWheelMaxSpeed > 1
{
MouseWheelMaxSpeed--
MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelMaxSpeedReal = 1
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% line
else
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelUp:
ButtonWheelDown:
If Button <> 0
{
If Button <> %A_ThisHotkey%
{
MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseWheelSpeed%
}
}
StringReplace, Button, A_ThisHotkey, *
ButtonWheelAccelerationStart:
If MouseWheelAccelerationSpeed >= 1
{
If MouseWheelMaxSpeed > %MouseWheelCurrentSpeed%
{
Temp = 0.001
Temp *= %MouseWheelAccelerationSpeed%
MouseWheelCurrentAccelerationSpeed += %Temp%
MouseWheelCurrentSpeed += %MouseWheelCurrentAccelerationSpeed%
}
}
If Button = y
MouseClick, wheelup,,, %MouseWheelCurrentSpeed%, 0, D
else if Button = n
MouseClick, wheeldown,,, %MouseWheelCurrentSpeed%, 0, D
SetTimer, ButtonWheelAccelerationEnd, 100
return
ButtonWheelAccelerationEnd:
GetKeyState, kstate, %Button%, P
if kstate = D
Goto ButtonWheelAccelerationStart
MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseWheelSpeed%
Button = 0
return