-
Notifications
You must be signed in to change notification settings - Fork 0
/
example - demo.ahk
71 lines (62 loc) · 1.84 KB
/
example - demo.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
#SingleInstance Force
#include "ScrollBall.ahk"
; This is used to record the demo GIF that you see in the repository
mouse := ScrollBall.Config()
mouse.conditions := ScrollBall.ManualStart()
wheel := ScrollBall.Config()
wheel.xAxis.scroller := ScrollBall.KeyScroller("^{PgUp}", "^{PgDn}")
wheel.xAxis.pixelsPerStep := 80
arrows := ScrollBall.Config()
arrows.unlockDelay := 30
arrows.xAxis.scroller := ScrollBall.KeyScroller("{left}", "{right}")
arrows.yAxis.scroller := ScrollBall.KeyScroller("{up}", "{down}")
arrows.xAxis.pixelsPerStep := 20
arrows.yAxis.pixelsPerStep := 30
arrows.xAxis.lockThreshold := 30
arrows.yAxis.lockThreshold := 30
media := ScrollBall.Config()
media.yAxis.scroller := ScrollBall.KeyScroller("{Volume_Up}", "{Volume_Down}")
media.xAxis.scroller := ScrollBall.KeyScroller("{Media_Prev}", "{Media_Next}")
media.xAxis.pixelsPerStep := 80
class WindowMover extends ScrollBall.Scroller {
__New(isVertical) {
this.isVertical := isVertical
this.stepped := false
}
Apply(delta) {
winDelay := SetWinDelay(-1)
hwnd := WinExist("A")
cx := 0
cy := 0
WinGetPos(&cx, &cy, , , hwnd)
if this.isVertical {
WinMove(, cy + delta, , , hwnd)
} else {
WinMove(cx + delta, , , , hwnd)
}
SetWinDelay(winDelay)
}
}
mover := ScrollBall.Config()
mover.diagonals := true
mover.xAxis.scroller := WindowMover(false)
mover.xAxis.pixelsPerStep := 1
mover.yAxis.scroller := WindowMover(true)
mover.yAxis.pixelsPerStep := 1
sb := ScrollBall(mouse)
+F1::sb.config := mouse
+F2::sb.config := wheel
+F3::sb.config := arrows
+F4::sb.config := media
+F5::sb.config := mover
sb.deviceID := 2137527569
configs := [mouse, wheel, arrows, media, mover]
config_id := 1
VKDC::{ ; Backslash
global config_id, configs
config_id := 1 + Mod(config_id, configs.Length)
trace("Config is now #" config_id)
sb.config := configs[config_id]
}
trace("hi!")
sb.Listen()