2018-03-28 22:31:25 +00:00
|
|
|
/*
|
|
|
|
Script to show data flowing from Interception
|
|
|
|
*/
|
2018-03-28 19:39:29 +00:00
|
|
|
#SingleInstance force
|
|
|
|
#Persistent
|
2019-06-08 20:56:58 +00:00
|
|
|
#include Lib\AutoHotInterception.ahk
|
2018-03-28 19:39:29 +00:00
|
|
|
|
|
|
|
OutputDebug DBGVIEWCLEAR
|
|
|
|
|
|
|
|
global DeviceList := {}
|
2018-03-28 21:15:20 +00:00
|
|
|
filterMouseMove := 1
|
2019-06-08 20:56:10 +00:00
|
|
|
filterKeyPress := 0
|
2018-03-28 19:39:29 +00:00
|
|
|
|
|
|
|
;~ global Monitor := AutoHotInterception_Init("InterceptionMonitor")
|
|
|
|
MonitorWrapper := new AutoHotInterception("Monitor")
|
2018-03-30 18:04:58 +00:00
|
|
|
global Monitor := MonitorWrapper.Instance
|
2018-03-28 19:39:29 +00:00
|
|
|
|
|
|
|
DeviceList := MonitorWrapper.GetDeviceList()
|
|
|
|
|
2018-03-30 18:00:33 +00:00
|
|
|
start := 0
|
2018-03-28 19:39:29 +00:00
|
|
|
|
2018-07-02 17:58:40 +00:00
|
|
|
colWidth := 350
|
|
|
|
Gui, Add, Text, w%colWidth% Center Section, Keyboards
|
2018-03-28 19:39:29 +00:00
|
|
|
Loop 2 {
|
|
|
|
isMouse := A_Index - 1
|
|
|
|
Loop 10 {
|
|
|
|
i := start + A_Index
|
|
|
|
dev := DeviceList[i]
|
|
|
|
if (!IsObject(dev)){
|
|
|
|
continue
|
|
|
|
}
|
2019-03-05 20:48:39 +00:00
|
|
|
Gui, Add, Checkbox, % "hwndhCb w" colWidth, % "ID: " dev.id ", VID: 0x" FormatHex(dev.VID) ", PID: 0x" FormatHex(dev.PID) "`nHandle: " StrReplace(dev.Handle, "&", "&&")
|
2018-03-28 19:39:29 +00:00
|
|
|
fn := Func("CheckboxChanged").Bind(dev.id)
|
|
|
|
GuiControl, +g, % hCb, % fn
|
|
|
|
}
|
|
|
|
if (!IsMouse){
|
2018-07-02 17:58:40 +00:00
|
|
|
Gui, Add, Text, x+5 ym w%colWidth% Center Section, Mice
|
2018-03-30 18:00:33 +00:00
|
|
|
start := 10
|
2018-03-28 19:39:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-02 17:58:40 +00:00
|
|
|
Gui, Add, CheckBox, w%colWidth% y+20 hwndhCbFilterMove Checked, Filter Movement (Warning: Turning off can cause crashes)
|
2018-03-28 21:15:20 +00:00
|
|
|
fn := Func("FilterMove")
|
|
|
|
GuiControl, +g, % hCbFilterMove, % fn
|
2019-06-08 20:56:10 +00:00
|
|
|
Gui, Add, CheckBox, w%colWidth% x10 y52 hwndhCbFilterPress, Show Presses instead of ups and downs
|
|
|
|
fnn := Func("FilterPress")
|
|
|
|
GuiControl, +g, % hCbFilterPress, % fnn
|
2018-07-02 17:58:40 +00:00
|
|
|
Gui, Add, Button, xm w%colWidth% Center gClearKeyboard, Clear
|
|
|
|
Gui, Add, Button, x+5 yp w%colWidth% gClearMouse Center, Clear
|
2018-03-28 21:15:20 +00:00
|
|
|
|
2019-02-24 19:32:07 +00:00
|
|
|
Gui, Add, ListView, xm w%colWidth% h400 hwndhLvKeyboard, ID|Code|State|Key Name|Info
|
|
|
|
LV_ModifyCol(4, 100)
|
|
|
|
LV_ModifyCol(5, 150)
|
2019-02-24 17:41:51 +00:00
|
|
|
Gui, Add, ListView, x+5 yp w%colWidth% h400 hwndhLvMouse, ID|Code|State|X|Y|Info
|
2019-02-24 19:32:07 +00:00
|
|
|
LV_ModifyCol(6, 200)
|
2018-03-28 19:39:29 +00:00
|
|
|
Gui, Show
|
|
|
|
|
|
|
|
|
|
|
|
Monitor.Subscribe(Func("KeyboardEvent"), Func("MouseEvent"))
|
|
|
|
return
|
|
|
|
|
|
|
|
CheckboxChanged(id, hwnd){
|
|
|
|
GuiControlGet, state, , % hwnd
|
|
|
|
ret := Monitor.SetDeviceFilterState(id, state)
|
|
|
|
;~ ToolTip % "Changed " id " to " state ". Return value: " ret
|
|
|
|
}
|
|
|
|
|
2018-03-28 21:15:20 +00:00
|
|
|
FilterMove(hwnd){
|
|
|
|
global filterMouseMove
|
|
|
|
GuiControlGet, state, , % hwnd
|
|
|
|
filterMouseMove := state
|
|
|
|
}
|
|
|
|
|
2019-06-08 20:56:10 +00:00
|
|
|
FilterPress(hwnd){
|
|
|
|
global filterKeyPress
|
|
|
|
GuiControlGet, state, , % hwnd
|
|
|
|
filterKeyPress := state
|
|
|
|
}
|
|
|
|
|
2018-03-28 21:15:20 +00:00
|
|
|
ClearKeyboard:
|
|
|
|
Gui, ListView, % hLvKeyboard
|
|
|
|
LV_Delete()
|
|
|
|
return
|
|
|
|
|
|
|
|
ClearMouse:
|
|
|
|
Gui, ListView, % hLvMouse
|
|
|
|
LV_Delete()
|
|
|
|
return
|
|
|
|
|
2018-03-28 19:39:29 +00:00
|
|
|
FormatHex(num){
|
|
|
|
return Format("{:04X}", num)
|
|
|
|
}
|
|
|
|
|
2019-02-24 17:41:51 +00:00
|
|
|
KeyboardEvent(id, code, state, info){
|
2019-06-08 20:56:10 +00:00
|
|
|
global hLvKeyboard, filterKeyPress
|
|
|
|
if (filterKeyPress && state)
|
|
|
|
return
|
2018-03-28 19:39:29 +00:00
|
|
|
Gui, ListView, % hLvKeyboard
|
2019-02-24 19:32:07 +00:00
|
|
|
scanCode := Format("{:x}", code)
|
|
|
|
keyName := GetKeyName("SC" scanCode)
|
|
|
|
row := LV_Add(, id, code, state, keyName, info)
|
2018-03-28 19:39:29 +00:00
|
|
|
LV_Modify(row, "Vis")
|
|
|
|
;~ ToolTip % "Keybd: " id "`nState: " state ", Code: " code
|
|
|
|
}
|
|
|
|
|
2019-02-24 17:41:51 +00:00
|
|
|
MouseEvent(id, code, state, x, y, info){
|
2018-03-28 21:15:20 +00:00
|
|
|
global hLvMouse, filterMouseMove
|
2019-02-24 17:41:51 +00:00
|
|
|
if (filterMouseMove && (x != 0 || y != 0))
|
2018-03-28 21:15:20 +00:00
|
|
|
return
|
2018-03-28 19:39:29 +00:00
|
|
|
Gui, ListView, % hLvMouse
|
2019-02-24 17:41:51 +00:00
|
|
|
row := LV_Add(, id, code, state, x, y, info)
|
2018-03-28 19:39:29 +00:00
|
|
|
LV_Modify(row, "Vis")
|
|
|
|
;~ ToolTip % "Mouse: " id "`nX: " x ", Y: " y
|
|
|
|
}
|
|
|
|
|
|
|
|
^Esc::
|
|
|
|
GuiClose:
|
2019-06-08 20:56:10 +00:00
|
|
|
ExitApp
|