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
228
229
230
231
232
233
234
235
236
237
238
|
#NoEnv
AllStar(This_HotKey) {
global
PhysKey := This_HotKey
if (SubStr(PhysKey,1,1) == "*")
PhysKey := SubStr(PhysKey,2)
if (SubStr(PhysKey,-2) == " up") {
PhysKey := SubStr(PhysKey,1,StrLen(PhysKey)-3)
IsDown := 0
} else
IsDown := 1
if (TransformProc != "")
ActKey := Transform%TransformProc%(PhysKey)
else
ActKey := PhysKey
if ((striktesMod2Lock == 0) && (NOC%ActKey% == 1))
Ebene := EbeneNC
else
Ebene := EbeneC
if (Ebene7 and (CP7%ActKey% != ""))
Char := CP7%ActKey%
else if (Ebene8 and (CP8%ActKey% != ""))
Char := CP8%ActKey%
else
Char := CP%Ebene%%ActKey%
if (PressHookProc != "") {
if (IsDown == 1)
PressHook%PressHookProc%(PhysKey, ActKey, Char)
else
CharStarUp(PhysKey)
} else if (IsDown == 1)
CharStarDown(PhysKey, ActKey, Char)
else
CharStarUp(PhysKey)
}
CharStarDown(PhysKey, ActKey, char) {
global
wasNonShiftKeyPressed := 1
if (PP%PhysKey% != "")
CompNew := PP%PhysKey% ; Von Tastaturwiederholung
else
CompNew := Comp . char ; Hängen wir mal das neue Zeichen zum Compositum an
if (CD%CompNew% != "") { ; Compose hat getroffen: wird geschickt, Compose gelöscht
tosend := CD%CompNew%
PP%PhysKey% := CompNew
Comp := ""
} else if (CM%CompNew% == 1) { ; Compose muss sich noch was merken: Jetzt noch nichts schicken.
tosend := ""
PP%PhysKey% := ""
Comp := CompNew
} else if (Comp == "") { ; noch kein Zeichen in der Compose-Queue: Ein einzelnes Zeichen wird geschickt
tosend := char
PP%PhysKey% := char
} else { ; Compose hat verfehlt: nichts schicken, auch aktuelles Zeichen nicht schicken
tosend := ""
PP%PhysKey% := ""
Comp := ""
}
if (strlen(tosend) > 5) { ; Ausgabe mehrerer Zeichen
if (PR%PhysKey% != "") { ; Eventuell vergessenen Key-Release aufräumen
CharOutUp(PR%PhysKey%)
PR%PhysKey% := ""
}
loop {
if (SubStr(tosend,1,1)=="P") {
SubProc := SubStr(tosend,2,4)
CharProc%SubProc%()
} else {
CharOut(SubStr(tosend,1,5))
}
tosend := SubStr(tosend,6)
if (tosend == "")
break ; erledigt
}
} else if (tosend != "") {
if (SubStr(tosend,1,1)=="P") {
if (PR%PhysKey% != "") {
CharOutUp(PR%PhysKey%)
PR%PhysKey% := ""
}
SubProc := SubStr(tosend,2,4)
CharProc%SubProc%()
} else {
if ((PR%PhysKey% != "") and (PR%PhysKey% != tosend))
CharOutUp(PR%PhysKey%)
PR%PhysKey% := tosend
CharOutDown(tosend)
}
} else if (PR%PhysKey% != "") {
CharOutUp(PR%PhysKey%)
PR%PhysKey% := ""
}
}
CharStarUp(PhysKey) {
global
if (PR%PhysKey% != "") {
tosend := PR%PhysKey%
PR%PhysKey% := ""
if (SubStr(tosend,1,1)=="P") {
SubProc := SubStr(tosend,2,4)
CharProc%SubProc%()
} else
CharOutUp(tosend)
}
PP%PhysKey% := ""
}
CharOut(char) {
global
if (CharOutFilterProc != "") {
char := CharOutFilter%CharOutFilterProc%(char,1,1)
if (char == "")
return
}
if (DNCS%char% != "")
SendBlindShiftFixed(char, DNCS%char% . UPCS%char%)
else if (CS%char% != "")
SendBlindShiftFixed(char, "{" . CS%char% . "}")
else
SendUnicodeChar("0x" . SubStr(char,2))
}
CharOutDown(char) {
global
if (CharOutFilterProc != "") {
char := CharOutFilter%CharOutFilterProc%(char,1,0)
if (char == "")
return
}
if (DNCS%char% != "")
SendBlindShiftFixed(char, DNCS%char%)
else if (CS%char% != "")
SendBlindShiftFixed(char, "{" . CS%char% . " down}")
else
SendUnicodeCharDown("0x" . SubStr(char,2))
}
CharOutUp(char) {
global
if (CharOutFilterProc != "") {
char := CharOutFilter%CharOutFilterProc%(char,0,1)
if (char == "")
return
}
if (DNCS%char% != "") {
if (UPCS%char% != "")
SendBlindShiftFixed(char, UPCS%char%)
} else if (CS%char% != "")
SendBlindShiftFixed(char, "{" . CS%char% . " up}")
else
SendUnicodeCharUp("0x" . SubStr(char,2))
}
SendBlindShiftFixed(char, theseq) {
global
if (UNSH%char%)
if (IsShiftLPressed)
if (IsShiftRPressed)
send % "{blind}{RShift Up}{Shift Up}" . theseq . "{Shift Down}{RShift Down}"
else
send % "{blind}{Shift Up}" . theseq . "{Shift Down}"
else
if (IsShiftRPressed)
send % "{blind}{RShift Up}" . theseq . "{RShift Down}"
else
send % "{blind}" . theseq
else
send % "{blind}" . theseq
}
CharProc(name) {
CharProc%name%()
}
CharProcRlod() {
global
; Neustart des AHK-Skripts
reload
}
SendUnicodeChar(charCode){
IfWinActive,ahk_class gdkWindowToplevel
{
StringLower,charCode,charCode
send % "^+u" . SubStr(charCode,3) . " "
} else {
static ki := "#"
if (ki =="#") {
VarSetCapacity(ki,28*2,0)
DllCall("RtlFillMemory","uint",&ki+ 0,"uint",1,"uint",1)
DllCall("RtlFillMemory","uint",&ki+28+0,"uint",1,"uint",1)
}
DllCall("ntdll.dll\RtlFillMemoryUlong","uint",&ki+ 6,"uint",4,"uint",0x40000|charCode) ;KEYEVENTF_UNICODE
DllCall("ntdll.dll\RtlFillMemoryUlong","uint",&ki+28+6,"uint",4,"uint",0x60000|charCode) ;KEYEVENTF_KEYUP|KEYEVENTF_UNICODE
DllCall("SendInput","UInt",2,"UInt",&ki,"Int",28)
}
}
SendUnicodeCharDown(charCode){
IfWinActive,ahk_class gdkWindowToplevel
{
StringLower,charCode,charCode
send % "^+u" . SubStr(charCode,3) . " "
} else {
static ki := "#"
if (ki =="#") {
VarSetCapacity(ki,28,0)
DllCall("RtlFillMemory","uint",&ki,"uint",1,"uint",1)
}
DllCall("ntdll.dll\RtlFillMemoryUlong","uint",&ki+6,"uint",4,"uint",0x40000|charCode) ;KEYEVENTF_UNICODE
DllCall("SendInput","UInt",1,"UInt",&ki,"Int",28)
}
}
SendUnicodeCharUp(charCode){
IfWinActive,ahk_class gdkWindowToplevel
{
; nothing
} else {
static ki := "#"
if (ki =="#") {
VarSetCapacity(ki,28,0)
DllCall("RtlFillMemory","uint",&ki,"uint",1,"uint",1)
}
DllCall("ntdll.dll\RtlFillMemoryUlong","uint",&ki+6,"uint",4,"uint",0x60000|charCode) ;KEYEVENTF_KEYUP|KEYEVENTF_UNICODE
DllCall("SendInput","UInt",1,"UInt",&ki,"Int",28)
}
}
|