Menu TT -> Other triggers. It opens a file with examples.
In that file add this somewhere inside the class:
In that file add this somewhere inside the class:
[Triggers]
void KeyboardHookTriggers() {
WindowsHook.Keyboard(k => {
var a = _lastKeys ??= new();
if (a.Count > 15) a.RemoveAt(a.Count - 1);
a.Insert(0, new(k.IsUp, k.Key, k.Mod, k.vkCode, k.scanCode, k.IsExtended, k.IsInjected, k.IsAlt, k.time));
//trigger LCtrl*2
if (k.vkCode == KKey.LCtrl) {
if (k.IsUp && a.Count >= 4 && a[1].vkCode == k.vkCode && !a[1].isUp && a[2].vkCode == k.vkCode && a[2].isUp && a[3].vkCode == k.vkCode && !a[3].isUp && a[1].time - a[3].time < 500 && (a.Count == 4 || a[4].vkCode != k.vkCode || a[3].time - a[4].time > 500)) {
//print.it("LCtrl*2");
script.run("Translate UI element text.cs");
}
}
//Add other triggers here.
// To block the key event: k.BlockEvent();
//Note: this function must be as fast as possible. Slow code here will make kayboard input slow.
// If need slow code, put it in other script or thread, and here just start the script or thread.
});
}
record _KeyEvent(bool isUp, KKey key, KMod mod, KKey vkCode, uint scanCode, bool isExtended, bool isInjected, bool isAlt, int time);
List<_KeyEvent> _lastKeys; //max 16 previous key events, starting from the most recent, including current event