AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

08 Mar 2018, 06:58

What can it do for me?
AHI allows you to react to keyboard and mouse events in much the same way as AHK does, only with multiple keyboards and/or mice.

It can work in two modes (Both work at the same time)
Context mode is the simplest - you wrap your normal hotkeys in an #if statement, and AHI turns them on when the specific keyboard you wish to react to is about to send an event, and off again afterwards.

Subscription mode is an alternative to AHK's normal hotkey system - you can get notification of the state of single keys (No multi-key bindings, you would have to handle that yourself), buttons etc, whilst optionally completely blocking Windows from seeing the event.
In Subscription mode, you can also subscribe to "Raw" mouse movement, as you would get from RawInput. Both "Relative" (Regular mouse) and "Aboslute" (Graphics Tablet / LightGun) mouse modes are supported.

In addition to both of the input modes, you can send input (button presses, mouse movement etc) from a specific device.

How does it work?
AHI is a wrapper for Francisco Lopez' Interception driver.
It is written in C# (All source is available on the GitHub page) and is packaged as a DLL
You load this DLL using Lexikos' CLR linrary, and it loads the main Interception DLL and handles interaction with it for you.
A handy AHK wrapper is provided to allow you to easily load the DLL.
All files except the Interception DLL are included, you just need to install the Interception driver and copy it's DLL into the folder you downloaded AHI into.

READ THE INSTRUCTIONS AND WARNINGS IN THE DOCUMENTATION!!

GitHub page (Documentation etc)

Download from here
Last edited by evilC on 02 May 2018, 04:23, edited 15 times in total.
TTLDR

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

08 Mar 2018, 09:03

Í love it, thanks for making It! makes my life by the pc alot more comfortable and easy
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

10 Mar 2018, 14:43

hi! does this work with mice?
at the moment I was trying with my keyboard, and I get "Interception Test failed"...
also I'm not sure if my keybosrd is "HID\VID_413C&PID_2003&REV_0301", so VID := 0x413C, PID := 0x2003?
thanks
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

12 Mar 2018, 16:07

Version 1.2 Released!
Context Mode and Subscription Mode can now be used together.
Added SendKeyEvent() method to send key events using Interception.
Added Combined Example.ahk featuring use of both modes at once, with SendKeyEvent
SquirrelHugger
Posts: 17
Joined: 23 Feb 2018, 04:17

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

14 Mar 2018, 08:12

This is awesome!

I am definitely checking this out. Cheers to you brother!
:morebeard:
grimboto
Posts: 53
Joined: 09 Jul 2014, 19:20

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

14 Mar 2018, 15:16

Just curious can the Inception DLL see events from a pen used with a tablet
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

14 Mar 2018, 18:08

I think so yes, but for now AHI is keyboard only.
It's most likely possible though, interception sees absolutely everything coming from keyboard / mouse devices.
Are you talking axes or buttons?
I have some code for relative axis input, but not coded for absolute input axes yet, need to lay my hands on a device that reports like that.
grimboto
Posts: 53
Joined: 09 Jul 2014, 19:20

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

14 Mar 2018, 22:56

when Windows rolled out the fall creators update, they changed the way the pen works. it used to work like a mouse where you could click and drag to select items on the screen, now if you click and drag it scrolls the window instead which is very annoying and i was looking for a solution to change it back. i'll have to investigate further to see what i can come up with
grimboto
Posts: 53
Joined: 09 Jul 2014, 19:20

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

18 Mar 2018, 16:32

its a Lenovo Yoga, the pen seems to use the wacom drivers though.
From the quick tests i've done interception can see when the barrel buttons are pressed but doesn't seem to get anything when the pen itself taps on the screen
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

18 Mar 2018, 20:50

By "quick tests with Interception", what do you mean? Using this library? Your own Interception code?
If the tablet is reporting in absolute mode, then a lot of Interception code would likely not recognize the information I think, because it is designed for relative mode (normal) mice.
Any code using AutoHotInterception would not be able to see ANY mouse buttons or movement yet, because it currently has no mouse support.
I do have some code for it, but it is not currently in AHI.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

22 Mar 2018, 16:15

@grimboto - I do seem to remember someone got light guns working using that interception library, but they may well have modified it to use absolute mode or something.
If you know any C#, I have some code you can play with that should be easier to work with than the AHK code in that thread - you get to use the debugger in Visual Studio (My code only hooks specific keyboards, not all, so you can use 2 keyboards to be able to use keyboard while debugging)

@everyone - Version 1.3 has been released!
I added support for right versions of modifier keys (ScanCodes >= 256)
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: AutoHotInterception - Per-keyboard hotkeys for AHK (Fire macros in response to key on a 2nd keyboard)

25 Mar 2018, 12:56

Version 1.4 released!
Added support for Mouse
Buttons work in Subscription and Context mode (No Wheel support yet)
Movement only works in Subscription mode
Relative (Normal) mouse movement only for now, plan to investigate Absolute as soon as I get a device
grimboto
Posts: 53
Joined: 09 Jul 2014, 19:20

Re: AutoHotInterception - Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

27 Mar 2018, 21:36

thanks for the offer @evilC unfortunately i don't know any C#. I'm keen to try the version with the added mouse support but the AutoHotInterception.dll seems to be missing from the libary folder in the latest update.
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

Re: AutoHotInterception - Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

28 Mar 2018, 11:11

Hi! with 1.4, I got the keyboard hook working, but I culdnt detect mice. In fact they dont list in the DeviceList msgbox.
I tested with both examples but no way... any advice with this?
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: AutoHotInterception - Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

29 Mar 2018, 04:12

I installed interception driver as Admin. I copied interception.dll into the Lib directory and renamed it to AutoHotInterception.dll. Then i tried monitor.ahk.
I got "Interception Test failed".

May be i forgot something to do?

I found that this.Interception.OkCheck() is empty and therefore the program stopped (exitapp). I tried to start the GUI by commenting the exitapp but this results in an empty Gui.

AHK v1.1.28, Win10 1709, x64

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: zabbn and 66 guests