Now compatible with AHK v2!
Old AHK v1 thread
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
AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
According to README.md I installed Intereception driver and extracted the "AHK v2" folder from .zip file on https://github.com/evilC/AutoHotInterception/releases/tag/v0.9.0
When I try to run Monitor.ahk it shows this: Please could take a look at this?
When I try to run Monitor.ahk it shows this: Please could take a look at this?
-
- Posts: 25
- Joined: 18 Apr 2019, 06:24
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Move the dll into the Lib folder, it seems the release put it in the wrong place for some reason.hpta wrote: ↑06 Apr 2023, 07:17According to README.md I installed Intereception driver and extracted the "AHK v2" folder from .zip file on https://github.com/evilC/AutoHotInterception/releases/tag/v0.9.0
When I try to run Monitor.ahk it shows this:
image.png
Please could take a look at this?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
@Adventurer I did exactly that and when I ran test.ahk I got:
Also, Where do you get the interception driver?
EDIT: if it is https://github.com/oblitum/Interception/releases then I need help. I put the extracted zip on my desktop and from an elevated terminal I ran cd C:\Users\LPIII\OneDrive\Desktop\AHK\Interception\Interception\command line installer then install-interception.exe /install. It then said Could not write to \system32\drivers.
Also, Where do you get the interception driver?
EDIT: if it is https://github.com/oblitum/Interception/releases then I need help. I put the extracted zip on my desktop and from an elevated terminal I ran cd C:\Users\LPIII\OneDrive\Desktop\AHK\Interception\Interception\command line installer then install-interception.exe /install. It then said Could not write to \system32\drivers.
-
- Posts: 25
- Joined: 18 Apr 2019, 06:24
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
You're on the right track, but if it's throwing you that error, you probably aren't actually on an elevated terminal. Try right clicking Start Menu, start Windows PowerShell (Admin) or Command Prompt (Admin), then run those commands again. (Except, if you're on PowerShell, you'll need to do .\install-interception.exe /install instead.)LAPIII wrote: ↑22 Apr 2023, 09:19@Adventurer I did exactly that and when I ran test.ahk I got:
test.ahk 22_04_23 10⦂14⦂52⦂533 AM.jpg
Also, Where do you get the interception driver?
EDIT: if it is https://github.com/oblitum/Interception/releases then I need help. I put the extracted zip on my desktop and from an elevated terminal I ran cd C:\Users\LPIII\OneDrive\Desktop\AHK\Interception\Interception\command line installer then install-interception.exe /install. It then said Could not write to \system32\drivers.
-
- Posts: 25
- Joined: 18 Apr 2019, 06:24
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
That's strange. Did you delete your "windir" environment variable, by chance?
Try setx windir C:\Windows /m from an admin terminal, close the terminal and reopen it to refresh the environment variables, and then try installing the interception driver again.
If that doesn't work, maybe you have your terminal set up in such a way that is removing all environment variables when launching. (I don't know how or why that would be the case, but I'm just covering all the bases here.) In which case, try running set "windir=C:\Windows" and then, without closing terminal, try the install-interception.exe /install command again.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
I wouldn't know how to delete my WINDIR environment.
-
- Posts: 25
- Joined: 18 Apr 2019, 06:24
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
As I said, you have to restart your terminal after the setx command.
If it's still not working, try typing set and make sure the windir variable is in the list it gives you, pointing to C:\Windows
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
I fixed the issue with a suggestion from someone on Github, which was to run install-interception.exe /uninstall instead of install-interception.exe /install. After a restart and then running the latter command, it installed successfully.
Last edited by LAPIII on 20 Jul 2023, 13:04, edited 1 time in total.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
How do I make it silently fail in the background if the device is not plugged in? Right now it throws an error and exits the whole script. Wrapping it in a try statement doesn't seem to help either.
Also in my compiled executable, running it the first time works as it should but running it a second time shows a messagebox with just the word "Failed", I tried looking inside AutoHotInterception.ahk but couldn't find any string that corresponds to this error so I have no clue where this error is coming from. If I delete the generated Lib folder by the executable it works again until the next time I close and reopen the exe.
Also in my compiled executable, running it the first time works as it should but running it a second time shows a messagebox with just the word "Failed", I tried looking inside AutoHotInterception.ahk but couldn't find any string that corresponds to this error so I have no clue where this error is coming from. If I delete the generated Lib folder by the executable it works again until the next time I close and reopen the exe.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Hi @evilC ! I am having a problem with remapping the mousewheel. It is working fine but the only problem is that it types the “w” or “s” while performing scroll at the same time. Please help.
Code: Select all
#Requires AutoHotkey v2.0-rc.2 64-bit
#SingleInstance force
Persistent
#include C:\Users\Sunny\Documents\Hotkey\AutoHotkeyInterception\Lib\AutoHotInterception.ahk
#MaxThreadsPerHotkey 1
AHI := AutoHotInterception()
zelotesc18Id := AHI.GetKeyboardId(0x12C9, 0x2003)
cm1 := AHI.CreateContextManager(zelotesc18Id)
#HotIf cm1.IsActive
*w::
{
while GetKeyState("w", "P"){
Sleep 50
SendInput "{WheelUp}"
Sleep 50
break
}
}
*s::
{
while GetKeyState("s", "P"){
Sleep 50
SendInput "{WheelDown}"
Sleep 50
break
}
}
#HotIf