-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathVKSend.ahk
62 lines (56 loc) · 1.65 KB
/
VKSend.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
VKSend(Sequence)
{
SetFormat, IntegerFast, hex
C_Index := 1
; StringReplace, Sequence, Sequence, %A_Space% ,, All ;stuffs up {shift down}
StringReplace, Sequence, Sequence, `t , %A_Space%, All
l := strlen(Sequence)
while (C_Index <= l)
{
char := SubStr(Sequence, C_Index, 1)
if (char = "+")
{
string .= "{VK" GetKeyVK("Shift") " down}"
ReleaseModifiers .= "{VK" GetKeyVK("Shift") " up}"
}
else if (char = "^")
{
string .= "{VK" GetKeyVK("Ctrl") " down}"
ReleaseModifiers .= "{VK" GetKeyVK("Ctrl") " up}"
}
else if (char = "!")
{
string .= "{VK" GetKeyVK("Alt") " down}"
ReleaseModifiers .= "{VK" GetKeyVK("Alt") " up}"
}
else if (char = "{") ; send {}} will fail with this test but cant use that
{ ; hotkey anyway in program would be ]
if (Position := instr(Sequence, "}", False, C_Index, 1)) ; lets find the closing bracket) n
{
key := trim(substr(Sequence, C_Index+1, Position - C_Index - 1))
C_Index := Position ;PositionOfClosingBracket
while (if instr(key, A_space A_space))
StringReplace, key, key, %A_space%%A_space%, %A_space%, All
StringSplit, outputKey, key, %A_Space%
if (outputKey0 = 2)
{
if instr(outputKey2, "Down")
string .= "{VK" GetKeyVK(outputKey1) " Down}" ReleaseModifiers
else if instr(outputKey2, "Up")
string .= "{VK" GetKeyVK(outputKey1) " Up}" ReleaseModifiers
}
else
string .= "{VK" GetKeyVK(key) "}" ReleaseModifiers
ReleaseModifiers .= ""
}
}
Else
{
string .= "{VK" GetKeyVK(char) "}" ReleaseModifiers
ReleaseModifiers := ""
}
C_Index++
}
SetFormat, IntegerFast, d
return string
}