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

Post your working scripts, libraries and tools
phasermaniac
Posts: 74
Joined: 09 Apr 2017, 14:05

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

Mmm, I updated but same problem.
I noticed that the Sourcecode.zip has the files updated to 10/4/2020, while AutoHotInterception.zip files seems older. So I updated AutoHotInterception.ahk, CLR.ahk and Unblocker.ps1 from Sourcecode.zip, is this right?

Many thanks anyway for your help!

tzink
Posts: 1
Joined: 11 Apr 2020, 17:09

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

I used this script without difficulty in the past. Thank you for this great work. However, after a reformat, I am having difficulty.

Specifically, I can't determine the VID/PID of my USB keyboard because of an error with Monitor.ahk

When I run Monitor.ahk and check any of the ID boxes, I get the following error:
Error in #include file
"C:\Users\asdf\OneDrive\Documents\AHK\Lib\AutoHotInterception.ahk":
0x80020006 - Unknown name.

Specifically: SubscribeKeyboard
...
Continue running the script?
Even if I press Yes continue, none of the IDs register any input from my keyboard.

Thanks!

ppapkor
Posts: 9
Joined: 30 Jan 2019, 03:22

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

hi im using this wonderful code over a year
Thanks a lot. you are my hero at all.

recently i'm stucking at "synthesize keep pressing key" problem.

For example if i press 'a' key on the notepad and keep pressing it,
the result will be 'a(little break)aaaaaaaaaaaaa'.

But when i synthesize key down with this code,
it ends with only single 'a'.

I know this could be done with multiple key down line but what I want to do is hold pressing down a key + move on to the next line.

keydown
(
running code area, while key is keep pressed(a aaaaaaaa...)
)
releasekey

Could it be possible?

nichatr
Posts: 7
Joined: 17 May 2019, 01:43
GitHub: nichatr

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

Hello evilC, thank you for the great library!

I've encountered a problem: when I use the autohotkeyinterception in a separate script which I load at the start from my main context menu script, it seems that the second keyboard is not recognized.
So I put the <Context Example.ahk> code inside my main script. It works correctly when the two keyboards are connected, but when the second keyboard is not connected the following statement

Code: Select all

id2 := AHI2.GetKeyboardId(0x258A, 0x1006, 1)

causes an "ExitApp" so no script is loaded.

I've checked the source code and found the problem is in function GetDeviceId()

Code: Select all

	GetDeviceId(IsMouse, VID, PID, instance := 1) {
static devType := {0: "Keyboard", 1: "Mouse"}
dev := this.Instance.GetDeviceId(IsMouse, VID, PID, instance)
if (dev == 0) {
MsgBox % "Could not get " devType[isMouse] " with VID " VID ", PID " PID ", Instance " instance
ExitApp
}
return dev
}


distante
Posts: 1
Joined: 31 May 2020, 07:47

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

Hi, this is my first post so please bare with me.

I have a mouse that I move between 2 devices. An I am wondering which is the best way to not loose the current mapping when the id is missing (I mean besides restarting the script).

Thank you and thanks for this wonderful tool!

jthunderpants
Posts: 1
Joined: 25 Aug 2020, 18:09

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

Hi, I first want to thank you for this work, it's awesome. I've got a second keyboard working with a few subscriptions. I'm new to this format and haven't had much luck with context hotkeys.

Is there a good source of examples for autohotinterception scripts? If not I'd appreciate some help to get me started:

My goal is to have my second keyboard be used for latex shortcuts. Eg. "a" -> "\alpha". I have that working already. How can I make it so that shift + "a" -> "\Alpha"? Right now shift + "a" -> "|ALPHA".

Another trickier question is, can I move my 'I-beam' cursor is located? E.g. If I had a hotkey that output "\frac{}{}", I'd want the cursor between the first braces pair. I haven't seen any examples like this.

Any tips / insight appreciated, thanks!

Zoxver
Posts: 1
Joined: 18 Dec 2020, 08:34

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

Guys, hello. I was looking for how to make my AHK work in the game Cyberpunk 2077. I need the keyboard buttons to be pressed in the game. Everything works in the notebook, but not in the game itself. I searched and came across you. Could you help me. Thanks in advance.
P.S. I don't speak English very well.

unicorn79
Posts: 1
Joined: 12 Jan 2021, 00:43

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

Hi there!

Can you help me, please, is it possible with AutoHotInterception programmatically detect (intercept, capture) which win api (for example - mouse_event) directly requests the application I specified or even intercept global api calls to windows user32.dll, which holds mouse_event...
That is, something similar to the API MONITOR.
I tired to install global hooks as shown down will not help me, since they capture the already accomplished fact of api execution, but i need to capture only the api call procedure fact before it is actually executed. (code only for example in autohotkey to understand what i mean)...


Code: Select all

        hHookKeybd := DllCall("SetWindowsHookEx"
, Int, WH_KEYBOARD_LL := 13
, UInt, RegisterCallback("LowLevelKeyboardProc", "Fast")
, UInt, DllCall("GetModuleHandle", UInt, 0)
, UInt, 0)

hHookMouse := DllCall("SetWindowsHookEx"
, Int, WH_MOUSE_LL := 14
, UInt, RegisterCallback("LowLevelMouseProc", "Fast")
, UInt, DllCall("GetModuleHandle", UInt, 0)
, UInt, 0)