-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusic-controller.ahk
63 lines (58 loc) · 1 KB
/
music-controller.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
title_prefix := "Pitch Detector: --- | "
StringLen, title_trim_length, title_prefix
;;games require a key press duration.
SetKeyDelay, -1, 10
While true
{
;;forces the title string to be at the start of the title
SetTitleMatchMode, 1
WinGetTitle, title, Pitch Detector
if !title
{
;;sleeps for one tenth of a second
Sleep 100
Continue
}
;;just get the letter
;note := SubStr(title, 17, 1)
key := SubStr(title, title_trim_length + 1)
;;for debugging
; IfWinActive ahk_class Notepad++
; {
; if key
; {
; if key != previousKey
; {
; Send {%previousKey% up}
; Send {%key% down}
; }
; }
; else
; {
; if previousKey
; {
; Send {%previousKey% up}
; }
; }
; }
if key
{
if key != previousKey
{
if previousKey
{
Send {%previousKey% up}
}
Send {%key% down}
}
}
else
{
if previousKey
{
Send {%previousKey% up}
}
}
previousKey := key
Sleep 10
}