I am pretty new to AHK script. I very appreciate the wonderful work you did.
I try to record the sequence of certain keys entered from a specific keyboard, and block them at the same time using the following code
#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
global AHI := new AutoHotInterception()
keyboardId := AHI.GetKeyboardId(0x5131, 0x2007)
str := ""
keys := ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Enter", "?", ";"]
Loop 13 {
name := keys[A_Index]
AHI.SubscribeKey(keyboardId, GetKeySC(name), true, Func("KeyEvent").Bind(name))
}
KeyEvent(name, state){
global str
if(state == 1){
return
}
if(name != "Enter"){
str .= name
} else {
xx := str
str := ""
MsgBox % xx
}
}
^Esc::
ExitApp
Most time I got the right sequence, but sometime the "Enter" key won't be blocked.
Sometime I got the wrong sequence, like I enter 123456, it shows me like 213456.
That means the KeyEvent not firing in order.
I don't know what to do now, or maybe you have a better idea to implement the purpose mentioned at the beginning.
I am pretty new to AHK script. I very appreciate the wonderful work you did. I try to record the sequence of certain keys entered from a specific keyboard, and block them at the same time using the following code
Most time I got the right sequence, but sometime the "Enter" key won't be blocked. Sometime I got the wrong sequence, like I enter 123456, it shows me like 213456. That means the KeyEvent not firing in order.
I don't know what to do now, or maybe you have a better idea to implement the purpose mentioned at the beginning.
Thanks a lot