Aaand once again, I spoke too soon.
The code so far works, but it was acting on regular keys. Now I need to also apply it to existing dead keys (I use the US international layout), and those are giving me trouble.
Here's the current code:
Code: Select all
DeadKey(sym)
{
static MacronKeys := {a: "ā", Ax: "Ā", e: "ē", Ex: "Ē", Ix: "Ī", i: "ī", Ox: "Ō", o: "ō", Æ: "Ǣ", æ: "ǣ", Yx: "Ȳ", y: "ȳ", Gx: "Ḡ", g: "ḡ"}
static CircumflexKeys := {a: "â", g: "ĝ"}
static DeadKeys := {"¯": MacronKeys}
Input, Char, L1
if (Char = " ") {
Send, %sym%
return
}
Char .= (RegExMatch(Char, "[A-Z]") && DeadKeys[sym].HasKey(Char "x")) ? "x" : ""
SendRaw % (DeadKeys[sym].HasKey(Char)? DeadKeys[sym][Char] : sym Char)
}
; ...
+6::
DeadKey("^")
return
Shift + 6 = ^ which on US Intl. is a deadkey already, but it doesn't support some characters that would make sense on it, like ĝ and others, so my intent is to expand existing deadkeys like it. I wouldn't mind reimplementing even those letters that
are supported, if need be.
The problem:
- Hotkey + "a" results in a regular a. Note that this wouldn't happen even without the script, since the original deadkey supports "a" already.
- Hotkey + space results in nothing.
- Hotkey + a character that isn't supported by the original nor my dead key causes the character to be printed normally, but then one character is eaten by the script.
- Hotkey + "g", a character which is not supported by the original deadkey, results in the same as above.
Unfortunately the key history isn't helpful either, because it simply detects shift, then 6, then the key I press, with no difference between doing it with a deadkey or a regular symbol.
How can I solve this?