Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Posted: 06 Oct 2021, 04:30
Hello!
I have an external 19 keys keypad and have managed to make it work and assign 18 keys to the 19, because the keys "0" and "00" have the same code. The plan is to assign a hotkey to each one. I understand that the "00" is a double press of "0". I have been researching and found out the way to achieve this is is to tell AHI/AHK to pay attention to the time between keystrokes, ie if >.075 send 1 command else send another. Is it possible to use A_TimeSincePriorHotkey? Appreciated if someone could please give me a hand.
I have an external 19 keys keypad and have managed to make it work and assign 18 keys to the 19, because the keys "0" and "00" have the same code. The plan is to assign a hotkey to each one. I understand that the "00" is a double press of "0". I have been researching and found out the way to achieve this is is to tell AHI/AHK to pay attention to the time between keystrokes, ie if >.075 send 1 command else send another. Is it possible to use A_TimeSincePriorHotkey? Appreciated if someone could please give me a hand.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
#Persistent
#include <AutoHotInterception>
AHI := new AutoHotInterception() ; Initializing Interception
keyboardId := AHI.GetKeyboardId(0x062A, 0x4101)
AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))
KeyEvent(code, state)
{
if (state) & (code=82) ; Specified condition for Num0 on external keypad. code82 is also assigned to Num00
{
Send, {LControl down}{z}{LControl up}
}
}