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!
AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
-
- Posts: 74
- Joined: 09 Apr 2017, 14:05
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:
Any advice?
Thanks!
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:
Even if I press Yes continue, none of the IDs register any input from my keyboard.Error in #include file
"C:\Users\asdf\OneDrive\Documents\AHK\Lib\AutoHotInterception.ahk":
0x80020006 - Unknown name.
Specifically: SubscribeKeyboard
...
Continue running the script?
Any advice?
Thanks!
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?
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?
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
causes an "ExitApp" so no script is loaded.
I've checked the source code and found the problem is in function GetDeviceId()
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)
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
}
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!
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!
-
- 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!
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!
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.
P.S. I don't speak English very well.
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)...
`
[Mod edit: [code][/code] tags added.]
`
I have read, that AutoHotInterception is able to capture events from real devices (keyboard and mouse), but I am interested in global capturing calls to the api as a whole (it can be a mousemove, 100, 100, 100 command from autohotkey or the movement of a real USB HID mouse) ...
I know for sure that this is possible by other programms, since the product Api Monitor v2 can do this, but there are no convenient tools for processing the information received. http://dl4.joxi.net/drive/2021/01/12/0013/2011/870363/63/f680aed021.jpg
Thanks for your suggestions!
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)
`
I have read, that AutoHotInterception is able to capture events from real devices (keyboard and mouse), but I am interested in global capturing calls to the api as a whole (it can be a mousemove, 100, 100, 100 command from autohotkey or the movement of a real USB HID mouse) ...
I know for sure that this is possible by other programms, since the product Api Monitor v2 can do this, but there are no convenient tools for processing the information received. http://dl4.joxi.net/drive/2021/01/12/0013/2011/870363/63/f680aed021.jpg
Thanks for your suggestions!
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
hi @Zoxver,
Are you specifically asking about the multi-device script or just AHK for gaming in general?
If you want to learn about AHK for gaming, there's a spot for all gaming questions in the forums.
Are you specifically asking about the multi-device script or just AHK for gaming in general?
If you want to learn about AHK for gaming, there's a spot for all gaming questions in the forums.
____________________________________
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Hi
Firstly, I would like to thank those involved in creating this amazing tool!
Secondly, I need some help...
I would like to completely block a set of keyboard and mice to a SPECIFIC application (game) whether the game window is IN FOCUS OR NOT.
All the information I've been able to gather:
Firstly, I would like to thank those involved in creating this amazing tool!
Secondly, I need some help...
I would like to completely block a set of keyboard and mice to a SPECIFIC application (game) whether the game window is IN FOCUS OR NOT.
All the information I've been able to gather:
Code: Select all
keyboardId := AHI.GetKeyboardIdFromHandle("ACPI\VEN_PNP&DEV_0303")
mouseId := AHI.GetMouseId(0x1532, 0x0088)
Application:
ahk_class PIGS_MainWnd
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Disculpen una pregunta,
Soy nuevo en el uso de estos scripts,
Y me gustaria saber como instalar correctamente la herramienta AHI en windows 10 home porque ya intente de varias maneras y no puedo hacerlo:
https://github.com/evilC/AutoHotInterception
Ademas si alguien me pudiera dar un ejemplo de como reconocer otro teclado y generar el código para este me seria de mucha ayuda.
Este codigo quiero aplicarlo a otro teclado diferente al que estoy usando
Gracias.
Soy nuevo en el uso de estos scripts,
Y me gustaria saber como instalar correctamente la herramienta AHI en windows 10 home porque ya intente de varias maneras y no puedo hacerlo:
https://github.com/evilC/AutoHotInterception
Ademas si alguien me pudiera dar un ejemplo de como reconocer otro teclado y generar el código para este me seria de mucha ayuda.
Code: Select all
#If !GetKeyState("NumLock", "T")
NumpadDiv::Send, a
NumpadMult::Send, b
NumpadSub::Send, c
NumpadAdd::Send, d
NumpadEnter::Send, e
NumpadHome::Send, f
NumpadUp::Send, g
NumpadPgUp::Send, h
NumpadLeft::Send, i
NumpadClear::Send, j
NumpadRight::Send, k
NumpadEnd::Send, l
NumpadDown::Send, m
NumpadPgDn::Send, n
NumpadIns::Send, p
NumpadDel::Send, o
; NumLock , CapsLock, ScrollLock
Gracias.
-
- Posts: 1
- Joined: 04 May 2021, 11:42
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
If anyone is hitting Interception's 10 device limit the following solution might help (read below).
My hardware devices were installing virtual devices that were neither needed nor used.
Due to that some 'real' devices that I really needed were indexed above 10 and were not working.
For example my Logitech MX Anywhere Mouse and Brydge W-Touch Trackpad both were installing virtual keyboards in their HID containers.
(To see the list of sub devices by container go to Device Manager->View menu->Devices by Container).
Disabling those keyboard sub-devices the usual way was not possible, since 'Disable Device' button in Device Manager->Device X Properties->Driver tab was greyed out.
However I managed to disable those unneeded virtual devices and free up some Interception slots using the Group Policy solution described here :
https://www.ghacks.net/2017/06/03/stop-windows-from-installing-drivers-for-specific-devices/ [Mod edit: Link fixed.]
P.S. Thank you to AHI creators for this tool - it helped me a lot in improving my daily productivity and workflow.
My hardware devices were installing virtual devices that were neither needed nor used.
Due to that some 'real' devices that I really needed were indexed above 10 and were not working.
For example my Logitech MX Anywhere Mouse and Brydge W-Touch Trackpad both were installing virtual keyboards in their HID containers.
(To see the list of sub devices by container go to Device Manager->View menu->Devices by Container).
Disabling those keyboard sub-devices the usual way was not possible, since 'Disable Device' button in Device Manager->Device X Properties->Driver tab was greyed out.
However I managed to disable those unneeded virtual devices and free up some Interception slots using the Group Policy solution described here :
https://www.ghacks.net/2017/06/03/stop-windows-from-installing-drivers-for-specific-devices/ [Mod edit: Link fixed.]
P.S. Thank you to AHI creators for this tool - it helped me a lot in improving my daily productivity and workflow.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
After executing UnsubscribeMouseButtons, it seems unable to subscribe again
Code: Select all
#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
global AHI := new AutoHotInterception()
AHI.SubscribeMouseButtons(13,false, Func("test1"))
Sleep 3000
AHI.SubscribeMouseButtons(13,true, Func("test2"))
test1(code, state)
{
static isLocked := false
if (state = 0)
{
isLocked := false
return
}
if (isLocked)
return
isLocked := true
ToolTip % "Mouse Button - Code: " code ", State: " state
AHI.UnsubscribeMouseButtons(13)
}
test2(code, state)
{
ToolTip % "Mouse Button - Code: " code ", State: " state
}
return
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
can you help me compile script, i have very little understanding in this
im trying to write scrip when hold ctrl and press A S or D for them to correspond with number pad action when using windows mouse keys
so when i hold ctrl and press A it will act as pressing ctrl and 4 on number pad ( in theory this should move cursor to the left )
when i hold ctrl and press S it will act as pressing ctrl and 5 on number pad ( in theory this should click the cursor )
so when i hold ctrl and press D it will act as pressing ctrl and 6 on number pad ( in theory this should move cursor to the right )
i tried doing this without AKI but fail, as it does not move cursor only inputs 4 5 6 in text boxes
these are my ID for A S D
this is my 4 5 6 on number pad
This is what i tried without AKI and it only inputs 4 5 6 in text box does not move cursor.
sorry for my bad English, i try my best to explain. i am in the discord (1MavZ) if you need quick answer
im trying to write scrip when hold ctrl and press A S or D for them to correspond with number pad action when using windows mouse keys
so when i hold ctrl and press A it will act as pressing ctrl and 4 on number pad ( in theory this should move cursor to the left )
when i hold ctrl and press S it will act as pressing ctrl and 5 on number pad ( in theory this should click the cursor )
so when i hold ctrl and press D it will act as pressing ctrl and 6 on number pad ( in theory this should move cursor to the right )
i tried doing this without AKI but fail, as it does not move cursor only inputs 4 5 6 in text boxes
these are my ID for A S D
this is my 4 5 6 on number pad
This is what i tried without AKI and it only inputs 4 5 6 in text box does not move cursor.
Code: Select all
^a::Send {Numpad4}
^s::Send {Numpad5}
^d::Send {Numpad6}
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
@mavz Windows mouse keys will probably not see keys sent by AHK's Send command, so probably won't work. Instead you should use AHI to send the keys
eg
But in general, this will be rubbish, as it won't work properly with diagonals
It's probably a lot simpler to just code your own equivalent of mouse keys
I have one here: https://github.com/evilC/TapHoldManager
See the KeyboardToMouse.ahk script (You will need to download the whole library, not just that one script)
Then change the keys to suit, eg
thm.Add("NumpadLeft", Func("HandleInput").Bind("x", "-1")) should be changed to thm.Add("^a", Func("HandleInput").Bind("x", "-1"))
Oh, and annoyingly, I left a tooltip command in on line 22, you can just comment that out
eg
Code: Select all
^a::AHI.SendKeyEvent(1, GetKeySC("Numpad4"), 1)
^a up::AHI.SendKeyEvent(1, GetKeySC("Numpad4"), 0)
It's probably a lot simpler to just code your own equivalent of mouse keys
I have one here: https://github.com/evilC/TapHoldManager
See the KeyboardToMouse.ahk script (You will need to download the whole library, not just that one script)
Then change the keys to suit, eg
thm.Add("NumpadLeft", Func("HandleInput").Bind("x", "-1")) should be changed to thm.Add("^a", Func("HandleInput").Bind("x", "-1"))
Oh, and annoyingly, I left a tooltip command in on line 22, you can just comment that out
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Hello everyone,
first I want to begin by thanking everyone involved in this project.
Having said that I wanted to ask something. I've read about AutoHotInterception and I'm very impressed by it, but before installing and using it I want to be sure it does what I think is capable of. I've made an AHK script that uses DllCall and mouse_event and then ef course, make my pointer move. But this movement is synthetic, if I were to use AHI to detect my mouse device. Could I turn those synthetic movements made with AHK into more 'organic' ones? Like if they were done by hand. If that's the case, I'll probably start playing with AHI and have followup questions once I start testing stuff.
Thanks a lot!
first I want to begin by thanking everyone involved in this project.
Having said that I wanted to ask something. I've read about AutoHotInterception and I'm very impressed by it, but before installing and using it I want to be sure it does what I think is capable of. I've made an AHK script that uses DllCall and mouse_event and then ef course, make my pointer move. But this movement is synthetic, if I were to use AHI to detect my mouse device. Could I turn those synthetic movements made with AHK into more 'organic' ones? Like if they were done by hand. If that's the case, I'll probably start playing with AHI and have followup questions once I start testing stuff.
Thanks a lot!
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Follow up question.
I read the documentation more extensively now and would like to clarify what I want to do exactly. From what I understand, I could get the mauseId of the device I'm using (it's a laptop, so I'm guessing mause devices will show the mause I use and probably the touchpad too). Then I could "AHI.SendMouseMove(<mouseId>, <x>, <y>)" to hide the event from windows to see it, correct?
That's kind of what I want to do, but what that function does is hide the movements of my mouse device and that's not exactly what I need, what I need is to hide the event I'm making using DllCall("mouse_event"). Is that possible? Can I hide a synthetic mause_event not made by any device, just script made?
I read the documentation more extensively now and would like to clarify what I want to do exactly. From what I understand, I could get the mauseId of the device I'm using (it's a laptop, so I'm guessing mause devices will show the mause I use and probably the touchpad too). Then I could "AHI.SendMouseMove(<mouseId>, <x>, <y>)" to hide the event from windows to see it, correct?
That's kind of what I want to do, but what that function does is hide the movements of my mouse device and that's not exactly what I need, what I need is to hide the event I'm making using DllCall("mouse_event"). Is that possible? Can I hide a synthetic mause_event not made by any device, just script made?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Hi, Thank you for make AHI, it is amazing.
I am new here and sorry for my simple question.
Can I remap keys for 2 different keyboard (keyboard 2 and keyboard 3) in 1 script.
If yes,can I please have example
Thank you very much.
I am new here and sorry for my simple question.
Can I remap keys for 2 different keyboard (keyboard 2 and keyboard 3) in 1 script.
If yes,can I please have example
Thank you very much.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Hi,
I am creating hotkeys using the hotkey command that call a label. Inside the label I want to record the device that pressed the key.
if(cm2.IsActive) {
device := "keyboard2"
}
doesn't work well. Presumably because when the label is reached, the isactive status of cm2 has expired.
Does anyone know a better way?
I am creating hotkeys using the hotkey command that call a label. Inside the label I want to record the device that pressed the key.
if(cm2.IsActive) {
device := "keyboard2"
}
doesn't work well. Presumably because when the label is reached, the isactive status of cm2 has expired.
Does anyone know a better way?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
does anyone know if
AHI.SendKeyEvent(keyboardId, GetKeySC(key), state)
can respect Sendlevel?
I think my other hotkeys aren't being triggered by SendKeyEvent because the sendlevel isn't high enough.
It works when I use send with sendlevel 2.
Another question: When I send a key event does it set isActive for the appropriate device for use in context mode?
AHI.SendKeyEvent(keyboardId, GetKeySC(key), state)
can respect Sendlevel?
I think my other hotkeys aren't being triggered by SendKeyEvent because the sendlevel isn't high enough.
It works when I use send with sendlevel 2.
Another question: When I send a key event does it set isActive for the appropriate device for use in context mode?
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 153 guests