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
Optical
Posts: 5
Joined: 30 Dec 2018, 04:05

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

31 Dec 2018, 02:48

evilC wrote:
30 Dec 2018, 19:07
I am not sure WinXp even had download protection....
https://docs.microsoft.com/en-us/dotnet ... windows-xp
WinXp supports up to .NET 4.0.3, I think AHI uses like 4.2 or something, so I would imagine it is not compatible with WinXP

Regarding Win7, as the dialog says, the other way to unblock is to right-click the DLLs and select properties. If it is blocked, you will be able to unblock it from that dialog.
Ok. Thank you! The problem was in old version .NET FRAMEWORK! updating of .NET solved problem.
Now i have this clear window.
interception_5.jpg
interception_5.jpg (28.94 KiB) Viewed 10794 times
I need to send keyboard keys. SendKeyEvent function need keyboardId. How to get this? Can you write simple example to send any keyboard key please?
Optical
Posts: 5
Joined: 30 Dec 2018, 04:05

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

31 Dec 2018, 02:59

I understood. Thanks a lot

Example:
#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

AHI .SendKeyEvent(1, 59, 1)
AHI .SendKeyEvent(1, 59, 0)
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

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

31 Dec 2018, 06:15

There is no point in trying to get AHI scripts to work if the monitor does not work.
You likely need to update other runtimes as well - I think Interception needs one of the Visual C Redistributables.
Basically, I make no effort to support legacy OSes - if you want to use one, you should update everything possible.
sfranky
Posts: 5
Joined: 02 Jan 2019, 11:17
Contact:

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

02 Jan 2019, 11:23

many thanks for your excellent work!
1) do conditionals #IfWinActive work? I haven't managed to get them to, either by wrapping the example ahk file (context) in one, or inserting one in the initial #if.. any ideas?
2) is it normal that sometimes either the keyboard or the mouse lock up completely (without me doing anything, or even having ran the script - maybe it's the prerequisite install?) ? For some reason, only my pentablet works. or the middle mouse button!!

thanks again!
sfranky
Posts: 5
Joined: 02 Jan 2019, 11:17
Contact:

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

03 Jan 2019, 08:02

I can say with certainty that whenever the computer wakes up from sleep, the mouse has stopped working, except its middle and 4/5 buttons. It's a BT logitech anywhere mx if it makes any difference. But I think it's an issue with the exe file that I had to install prior to using the ahk wrapper, since this happens without loading the ahk file.. so maybe i should ...post that..there... :oops:
sfranky
Posts: 5
Joined: 02 Jan 2019, 11:17
Contact:

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

03 Jan 2019, 16:36

no, the AHI script does not have to be running. It's the interception exe (install-interception.exe /install) that i installed before running the script that did it. When I uninstalled it everything worked fine again. But now i don't have a second keyboard to play with :(
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

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

03 Jan 2019, 17:25

Regarding the # directives - you need the #if cm1.IsActive to differentiate devices, but I am not sure you could nest an #IfWinActive
I think something like #if cm1.IsActive && WinActive("blah") may work

I will have to investigate the lockups on sleep issue, can't say that I have ever seen anything strange in that regard.

Can you clarify the exact steps to reproduce?
1) Install interception
2) Plug in two identical devices
3) Start -> Shut Down -> Sleep
4) Wake PC
5) ? 2nd keyboard only ? inoperable
sfranky
Posts: 5
Joined: 02 Jan 2019, 11:17
Contact:

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

04 Jan 2019, 02:31

The steps are:
0) two keyboard devices already plugged in, one wired and one BT, one BT mouse, one pen tablet
1) Install interception
2) restart -> Shut Down -> Sleep (OR just leave it for some time, maybe a few hours, without sleeping)
4) Wake PC
5) inoperable: 1st keyboard, 2nd keyboard, mouse except middle button,
operable: pen tablet !!! (xp pen)

as for the && with WinActive, thanks, I will try it!
sfranky
Posts: 5
Joined: 02 Jan 2019, 11:17
Contact:

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

05 Jan 2019, 06:18

will try to test this and get back to you. Thanks very much!
M_L
Posts: 13
Joined: 21 Mar 2016, 06:54

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

07 Jan 2019, 08:20

@EvilC concerning the issue with the blank/empty Monitor. You need to restart after installing Interception. It says so in the install-interception cmd. You might wanna add a reminder to the doc.
M_L
Posts: 13
Joined: 21 Mar 2016, 06:54

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

13 Jan 2019, 03:50

Could be. I just repeat what's written in the install-interception cmd. There it says you need to restart. But anyway, not knowing could make people wonder why it's not working.
Sdentin Heyatszhem
Posts: 3
Joined: 16 Jan 2019, 17:42

16 Jan 2019, 18:00

I'm not sure if this is the result of me having installed Interception wrongly, but Monitor is displaying the VID/PID of my keyboard as "0x0000" and I tried using that value in ContextExample only for it to return "Could not get Keyboard with VID 0x000, PID 0x000, Instance 1".

Monitor seems to be working correctly:
Image

The change I made to "Context Example.ahk":
Image

Error message:
Image

Any thoughts on what I might be doing wrongly?
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

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

18 Jan 2019, 08:13

FYI, for those interested, we are starting to try and reverse-engineer Interception to remove the 10 device limit.
If you are one of those people who wants to see this happen, you can really help us out with testing, as I am not sure I have enough devices to push me over that limit.
Please jump into our Discord Channel if you can help test
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

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

18 Jan 2019, 08:14

@Sdentin Heyatszhem that behaviour would be expected for devices which are not regular USB.
PS/2 devices, and built-in keyboards for laptops etc will quite possibly fall into this category

Looking into it, I don't see how this is context mode specific
The "Could not get Keyboard with VID 0x000, PID 0x000, Instance 1" message would be thrown by a line like keyboardId := AHI.GetKeyboardId(0x0, 0x0), which would be common to both Context and Subscription mode
beepboop
Posts: 2
Joined: 29 Oct 2018, 23:27

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

25 Jan 2019, 03:05

This is great stuff, thanks for making it!

Say I want to post a ToolTip containing the letter typed, but only for the letters a, b and c. I can see a messy way - make a new KeyEvent function for each letter X, with the line ToolTip % "X" in an appropriate spot.

Is there a way to access the GetKeySC() argument of AHI.SubscribeKey() from within KeyEvent()? I could use this value to replace X, so the code would be much cleaner

Thanks in advance :)
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

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

25 Jan 2019, 05:31

You can use function binding to pass extra parameters to the function

Here I add the name of the key and the code gotten from GetKeySC

Code: Select all

#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

keyboardId := AHI.GetKeyboardId(0x04F2, 0x0112)
sc :=  GetKeySC("a")
AHI.SubscribeKey(keyboardId, sc, true, Func("ABC").Bind("a", sc))
sc :=  GetKeySC("b")
AHI.SubscribeKey(keyboardId, sc, true, Func("ABC").Bind("b", sc))
sc :=  GetKeySC("c")
AHI.SubscribeKey(keyboardId, sc, true, Func("ABC").Bind("c", sc))
return

; Code holds SC, name holds "a", "b" or "c"
ABC(code, name, state){
	ToolTip % "State: " state
}

^Esc::
	ExitApp
ppapkor
Posts: 14
Joined: 30 Jan 2019, 03:22

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

30 Jan 2019, 03:31

really nice work :)

I've seen this post from here
https://www.autohotkey.com/boards/viewtopic.php?t=27007
I was using class_dd with AHK but AHI seems much more better, I decided to drop dd and use AHI.

I installed interception driver and it works perfectly everywhere excpet on target app (online MMORPG game).
Game somehow detect this is not genuine hardware keypress and convict me as a hack user.
I'm pretty sure it is not because AHK, but this interception.dll code b/c it can be still bypassed by DD.
* when I use this code, app knows this is not genuine keypress. (working on other app like notepad is fine)
AHI.SendKeyEvent(keyboardId, GetKeySC(key), 1)


any idea why?

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 79 guests