AutoHotInterception/Combined Example.ahk

33 lines
602 B
AutoHotkey
Raw Normal View History

#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
2018-03-30 18:04:58 +00:00
global AHI := new AutoHotInterception()
2018-03-30 18:04:58 +00:00
keyboardId := AHI.GetKeyboardId(0x04F2, 0x0112)
2018-03-30 18:04:58 +00:00
AHI.SubscribeKey(keyboardId, GetKeySC("2"), true, Func("KeyEvent"))
2018-03-30 18:04:58 +00:00
cm1 := AHI.CreateContextManager(keyboardId)
return
2018-03-12 20:38:59 +00:00
KeyEvent(state){
static ctrlCode := GetKeySC("Ctrl")
global keyboardId
2018-03-30 18:04:58 +00:00
;~ AHI.SendKeyEvent(keyboardId, ctrlCode, state)
2018-03-28 19:39:29 +00:00
ToolTip % "State: " state
2018-03-12 20:38:59 +00:00
}
2018-03-30 18:04:58 +00:00
#if cm1.IsActive
2018-03-12 20:38:59 +00:00
::aaa::JACKPOT
1::
ToolTip % "KEY DOWN EVENT @ " A_TickCount
return
2018-03-12 20:38:59 +00:00
1 up::
ToolTip % "KEY UP EVENT @ " A_TickCount
return
#if
^Esc::
ExitApp