-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgp7ts.ahk
39 lines (33 loc) · 2.95 KB
/
gp7ts.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
#include <UIA>
UIA := UIA_Interface(), cond = UIA.CreatePropertyCondition(30003, 50000, 3)
beats := [.125, .25, .375, .5, .625, .75, .875, 1, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2, 2.125, 2.25, 2.375, 2.5, 2.625, 2.75, 2.875, 3, 3.125, 3.25, 3.375, 3.5, 3.625, 3.75, 3.875, 4, 4.25, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6, 6.25, 6.5, 6.75, 7, 7.25, 7.5, 7.75, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 15, 15.5, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128]
times := [[1.32], [1.16, 2.32], [3.32], [1.8, 2.16, 4.32], [5.32], [3.16, 6.32], [7.32], [1.4, 2.8, 4.16, 8.32], [9.32], [5.16, 10.32], [11.32], [3.8, 6.16, 12.32], [13.32], [7.16, 14.32], [15.32], [2.4, 4.8, 8.16, 16.32, 1.2], [17.32], [9.16, 18.32], [19.32], [5.8, 10.16, 20.32], [21.32], [11.16, 22.32], [23.32], [3.4, 6.8, 12.16, 24.32], [25.32], [13.16, 26.32], [27.32], [7.8, 14.16, 28.32], [29.32], [15.16, 30.32], [31.32], [4.4, 8.8, 16.16, 32.32, 1.1, 2.2], [17.16], [9.8, 18.16], [19.16], [5.4, 10.8, 20.16], [21.16], [11.8, 22.16], [23.16], [6.4, 12.8, 24.16, 3.2], [25.16], [13.8, 26.16], [27.16], [7.4, 14.8, 28.16], [29.16], [15.8, 30.16], [31.16], [8.4, 16.8, 32.16, 2.1, 4.2], [17.8]]
times.push([[9.4, 18.8], [19.8], [10.4, 20.8, 5.2], [21.8], [11.4, 22.8], [23.8], [12.4, 24.8, 3.1, 6.2], [25.8], [13.4, 26.8], [27.8], [14.4, 28.8, 7.2], [29.8], [15.4, 30.8], [31.8], [16.4, 32.8, 4.1, 8.2], [17.4], [18.4, 9.2], [19.4], [20.4, 10.2, 5.1], [21.4], [22.4, 11.2], [23.4], [24.4, 12.2, 6.1], [25.4], [26.4, 13.2], [27.4], [28.4, 14.2, 7.1], [29.4], [30.4, 15.2], [31.4], [32.4, 16.2, 8.1], [17.2], [18.2, 9.1], [19.2], [20.2, 10.1], [21.2], [22.2, 11.1], [23.2], [24.2, 12.1], [25.2], [26.2, 13.1], [27.2], [28.2, 14.1], [29.2], [30.2, 15.1], [31.2], [32.2, 16.1], [17.1], [18.1], [19.1], [20.1], [21.1], [22.1], [23.1], [24.1], [25.1], [26.1], [27.1], [28.1], [29.1], [30.1], [31.1], [32.1]]*)
#if WinActive("ahk_exe GuitarPro.exe") || ($7 := WinActive("ahk_exe GuitarPro7.exe"))
+SC029::
next := false
SC029::
buttons := UIA.ElementFromHandle(WinExist("A")).FindAll(cond, 0x4)
for b in buttons {
if b < 10
continue
if buttons[b].CurrentName ~= "^\d+\.\d+:" {
dur := strsplit(buttons[b].CurrentName, ":")[1]
cpos := buttons[b - 1].CurrentName
break
}
}
if dur not between .125 and 128
return
i := 0
while beats[++i] < dur
continue
(last = beats[i] && times[i][j := next ? ++j : j > 1 ? --j : times[i].MaxIndex()] && pos = cpos) || j := 1
last := beats[i], pos = cpos, dur = "", next = true, ts = strsplit(times[i][j], ".")
if $7 {
send ^t
sendinput % "+{Tab 4}" (ts[2] = 1 ? "{End}" : "") ts[2] "+{Tab}{Home}" (substr(ts[1], 1, 1) = 1 ? "{End}" : "") ts[1] "{Enter}"
$7 := false
}
else
sendinput % "^e" ts[1] "/" ts[2] "{Enter}"