-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactions.ahk
228 lines (177 loc) · 3.91 KB
/
actions.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
; FOLLOWING IS DONE BY d0ot[at]github
; Configurations start
; get it by Windows Spy
global lasso_offset_x := 227
global lasso_offset_y := 125
global earser_offset_x := 357
global earser_offset_y := 125
global pen1_offset_x := 420
global pen1_offset_y := 125
global win_title_regex := ".*OneNote"
global program_executable := "OneNoteUWP"
global click_max_interval := 300
; Configurations end
; Wacom Feel It Constant for GB12
global PEN_X_MAX := 25272
global PEN_Y_MAX := 16848
global last_input_time
apply_click(winTitleRegEx, offset_x, offset_y)
{
winTitle := "Not Found"
SetTitleMatchMode, RegEx
WinGetTitle, winTitle, %winTitleRegEx%
WinGetPos, x, y, w, h, %winTitle%
click_x := x + offset_x
click_y := y + offset_y
CoordMode, Mouse, Screen
click, %click_x%, %click_y%
}
select_draw(offset_x, offset_y)
{
Send, {Alt Down}d{Alt Up}
Sleep, 100
apply_click(win_title_regex, offset_x, offset_y)
}
global btn_timer_on := 0
global btn_up_count := 0
global btn_down_count := 0
global btn_last_down_count := 0
global btn_last_up_count := 0
global btn_touching := 0
button_timer()
{
if(btn_down_count = btn_last_down_count)
{
SetTimer, button_timer, Off
btn_timer_on := 0
; if touching down, all btn donw input is assumed to be invalid
if(btn_touching = 1)
{
return
}
; btn_down_count times press and release
if(btn_up_count = btn_down_count)
{
; debug code
; MsgBox, %btn_down_count% times, not long;
actions(btn_down_count, 0)
}
else
{
; btn_down_count times press and
; btn_up_count times release
; long press detected
; debug code
; MsgBox, %btn_down_count% times, long;
actions(btn_down_count, 1)
}
}else
{
btn_last_down_count := btn_down_count
btn_last_up_count := btn_up_count
}
}
#^e::
SetTitleMatchMode, RegEx
if WinExist(win_title_regex)
{
WinActivate, %win_title_regex%
select_draw(earser_offset_x, earser_offset_y)
}
else
{
MsgBox, OneNote is not running.
}
return
#^l::
SetTitleMatchMode, RegEx
if WinExist(win_title_regex)
{
WinActivate, %win_title_regex%
select_draw(lasso_offset_x, lasso_offset_y)
}
else
{
MsgBox, OneNote is not running.
Run, %program_executable%
}
return
; single click for pen
; double click for lasso
; for pen btn down
F9::
MsgBox, F9
if (btn_timer_on = 0)
{
btn_down_count := 1
btn_down_last_count := 1
btn_up_count := 0
btn_last_up_count := 0
btn_touching := 0
btn_timer_on := 1
SetTimer, button_timer, %click_max_interval%
}
else
{
btn_down_count := btn_down_count + 1
}
return
; for pen btn up
F10::
MsgBox, F10
if (btn_timer_on = 1)
{
btn_up_count := btn_up_count + 1
}
F11::
btn_touching := 1
; times of press
; long is 1 for long press
actions(times, long)
{
if(long = 0)
{
if(times = 1)
{
MsgBox, There will be a menu
}
if(times = 2)
{
apply_click(win_title_regex, pen1_offset_x, pen1_offset_y)
return
}
if(times = 3)
{
Send, #+s
return
}
}else
{
if(times = 1)
{
apply_click(win_title_regex, lasso_offset_x, lasso_offset_y)
}
}
}
return
Gui, New, +AlwaysOnTop -Caption +LastFound +Hwndgui1Hwnd
MsgBox, %gui1Hwnd%
Gui, %gui1Hwnd%:Add, Text,, Quick Panel
Gui, %gui1Hwnd%:Add, Button, Default w100, Copy
Gui, %gui1Hwnd%:Add, Button, Default w100, Paste
Gui, %gui1Hwnd%:Add, Button, Default w100, Delete
F8::
Gui, %gui1Hwnd%:Show
return
ButtonCopy:
Gui, %gui1Hwnd%:Hide
Send, {CtrlDown}c{CtrlUp}}
return
ButtonPaste:
Gui, %gui1Hwnd%:Hide
Send, {CtrlDown}v{CtrlUp
return
ButtonDelete:
Gui, %gui1Hwnd%:Hide
Send, {Delete Down}{Delete Up}
return