You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AutoHotInterception/Context Example.ahk

42 lines
841 B
Plaintext

6 years ago
#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
VID := 0x04F2, PID := 0x0112
6 years ago
InterceptionWrapper := new AutoHotInterception()
global Interception := InterceptionWrapper.GetInstance()
6 years ago
6 years ago
devices := InterceptionWrapper.GetDeviceList()
if (!devices.Length()){
6 years ago
msgbox Device List Check failed
ExitApp
}
6 years ago
keyboardId := Interception.GetDeviceId(false, VID, PID)
6 years ago
6 years ago
result := Interception.SetContextCallback(keyboardId, Func("SetKb1Context"))
6 years ago
if (result != -1){
msgbox Subscribe failed
ExitApp
}
return
SetKb1Context(state){
global isKeyboard1Active
6 years ago
Sleep 0 ; We seem to need this for hotstrings to work, not sure why
6 years ago
isKeyboard1Active := state
}
#if isKeyboard1Active
::aaa::JACKPOT
1::
ToolTip % "KEY DOWN EVENT @ " A_TickCount
return
1 up::
ToolTip % "KEY UP EVENT @ " A_TickCount
return
#if
^Esc::
ExitApp