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
jsf
Posts: 7
Joined: 24 Jun 2020, 16:08

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

06 Oct 2021, 04:30

Hello!
I have an external 19 keys keypad and have managed to make it work and assign 18 keys to the 19, because the keys "0" and "00" have the same code. The plan is to assign a hotkey to each one. I understand that the "00" is a double press of "0". I have been researching and found out the way to achieve this is is to tell AHI/AHK to pay attention to the time between keystrokes, ie if >.075 send 1 command else send another. Is it possible to use A_TimeSincePriorHotkey? Appreciated if someone could please give me a hand.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance force
#Persistent
#include <AutoHotInterception>

AHI := new AutoHotInterception() ; Initializing Interception

keyboardId := AHI.GetKeyboardId(0x062A, 0x4101)

AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))

KeyEvent(code, state) 

{	

	if (state) & (code=82) ; Specified condition for Num0 on external keypad. code82 is also assigned to Num00
	{
	Send, {LControl down}{z}{LControl up}
	}
}	
Makron
Posts: 1
Joined: 09 Oct 2021, 04:11

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

09 Oct 2021, 04:14

Amazing work have been using for over a year..

But I have a question does it work as without issueson windows 11?
krl
Posts: 12
Joined: 15 Dec 2019, 05:45

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

31 Oct 2021, 11:16

Does AHI make it possible to block some keys and in the same time allow them in combinations?

For example one application get state of "ctrl" key on low level and do something when it pressed. "Ctrl" need to be block here. Autohotkey can't block it with usual means (ctrl::return). AHI can block ctrl, but there is key combination (e.g. ^a - select all) that need to be preseved.

So, the only way is to subscribe on all keys with AHI, and then monitor them until "a" pressed and check the state of "Ctrl" at this moment? Ot there is something simplier?
Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

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

16 Dec 2021, 08:02

I've read whole thread and I already have problems running Monitor.ahk:

---------------------------
Monitor.ahk
---------------------------
Unable to find D:\lepes\Downloads\ahk\Interception\Lib\AutoHotInterception.ahk\..\x64\interception.dll, exiting...
You should extract both x86 and x64 folders from the library folder in interception.zip into AHI's lib folder.
---------------------------
Aceptar
---------------------------

I'm using:
Win 8.1 64 bits
AutoHotkey 1.1.33.08
AutoHotInterception 0.5.3

I executed PowerShell as admin with the following results:
---------------------------
Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. Todos los derechos reservados.

PS C:\windows\system32> d:
PS D:\> cd lepes\downloads\ahk\Interception\lib
PS D:\lepes\downloads\ahk\Interception\lib> ls


Directorio: D:\lepes\downloads\ahk\Interception\lib


Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 14/12/2021 18:22 x64
d---- 14/12/2021 18:14 x86
-a--- 15/12/2019 18:59 7085 AutoHotInterception.ahk
-a--- 26/02/2019 20:12 5732 CLR.ahk
-a--- 19/03/2018 21:03 47 Unblocker.ps1


PS D:\lepes\downloads\ahk\Interception\lib> .\Unblocker.ps1
PS D:\lepes\downloads\ahk\Interception\lib>
---------------------------
It seems is all right, I think!!

Then run monitor.ahk and I get the previous Msgbox.

I have "total control" of autoHotIntercepñtion.dll file:
21_12_16__1_51_41.PNG
21_12_16__1_51_41.PNG (17.82 KiB) Viewed 5250 times
I think files are in the right folders too:
21_12_16__2_00_28.PNG
21_12_16__2_00_28.PNG (48.9 KiB) Viewed 5250 times
Is there something I can test?

Thank in advance!
sinakko
Posts: 4
Joined: 17 Dec 2021, 14:53

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

17 Dec 2021, 15:54

IAutoHotInterception.dll, select
Properties, and if there is an 'Unblock’ checkbox, tick it. I have tried the recommended actions, the result is the same
Unblocker only runs with PowerShell, which immediately gives an error.All files in the folders are unlocked But the result is the same
Attachments
Screenshot_102.png
Screenshot_102.png (61.22 KiB) Viewed 5189 times
Screenshot_1.png
Screenshot_1.png (45.71 KiB) Viewed 5189 times
Screenshot_2.png
Screenshot_2.png (49.1 KiB) Viewed 5189 times
Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

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

17 Dec 2021, 16:14

@sinakko if PowerShell gives you an error about "script are disabled in this machine" do this:
- Open PowerShell as admin
- type this: Set-ExecutionPolicy Unrestricted
- navigate to Unblocker and run, the error is gone.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

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

18 Dec 2021, 03:25

why see what the error was, when u can just guess instead?? nice implementation...
https://github.com/evilC/AutoHotInterception/blob/master/Lib/AutoHotInterception.ahk#L49-L56
https://github.com/evilC/AutoHotInterception/blob/master/Lib/CLR.ahk#L17

implement some normal error checking instead of.. whatever this is and rerun ur script. then ull know whats wrong
sinakko
Posts: 4
Joined: 17 Dec 2021, 14:53

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

18 Dec 2021, 04:07

run the script from the second link using the AHK?
sinakko
Posts: 4
Joined: 17 Dec 2021, 14:53

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

18 Dec 2021, 04:18

No, these are options for programmers, it's too complicated for me
FLINT900
Posts: 1
Joined: 18 Dec 2021, 04:30

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

18 Dec 2021, 04:38

I have been suffering with the same problem for a long time, I have everything installed and checked as indicated in the readme
could you help me with launching and debugging AHI online using teamweaver or anidesk?
jkwaza
Posts: 7
Joined: 13 Jan 2022, 11:23

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

13 Jan 2022, 11:46

Hello, firstly thank you @evilC for making AutoHotInterception, and everyone else making AutoHotkey so awesome and useful.
After some tweaking successfully got an external USB numpad to work using the SubscribeAll Example as a base. Then added "if Winactive" within the "keyevent" to have different mappings depending on the active window. Very powerful indeed.

Secondly, feeling invincible, I decided to see if I could get an old bluetooth keyboard to work with it.
So far it appears in the AutoHotInterception Monitor as well as showing key press codes.
The VID/PID shown is 0x0000, 0x0000.
The Handle has unique identifying information but is not formatted like handles of other devices:

Code: Select all

HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&000204e8_PID&7021&Col01
When I put this into GetKeyboardIdFromHandle(), it won't run because of the "\". So I put the handle in quotations, which runs but won't intercept key presses.

Code: Select all

keyboardId := AHI.GetKeyboardIdFromHandle("HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&000204e8_PID&7021&Col01")
I have also tried manually trying to extract what looks like the VID and PID number but the VID seems to have an extra number in there.

My question is: How can I get AHI to recognise this handle?

EDIT:

It seems that when the handle is in quotations it runs because it recognises the handle, but is not able to intercept key presses.

EDIT 2:

OMG got it!
Putting ",3" (denotes the instance, of course) after the device handle string, because in AutoHotIntception Monitor it is the 3rd instance of the keyboard, presumably in this session of Windows. The clues were all there.

Code: Select all

keyboardId := AHI.GetKeyboardIdFromHandle("HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&000204e8_PID&7021&Col01", 3)
The USB numpad didn't need an instance number. Not sure yet if I'll have to manually change the instance number each time it reconnects or after a Windows restart.
Either way, good result.

Cheers,
John
Last edited by jkwaza on 13 Jan 2022, 17:27, edited 4 times in total.
jkwaza
Posts: 7
Joined: 13 Jan 2022, 11:23

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

13 Jan 2022, 12:01

If you're getting errors about interception.dll, check you have run Command Prompt as administrator to run the installer.

Windows Key > type "cmd" > right click on Command Prompt > Run as administrator > manually change directory to where the install-interception.exe file is > run it (it will say run with /install) > run with /install.

Also check you have put the DLLs in the same directory structure as per the instructions: https://github.com/evilC/AutoHotInterception/blob/master/README.md
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

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

14 Jan 2022, 13:07

AHI 0.6.0 has been released
https://github.com/evilC/AutoHotInterception/releases

Input should now be processed significantly faster.
A bunch has changed, and I have concerns as to whether I have broken anything, so please test and report any problems.
Things to test:
* Mouse Movement scripts (These should perform noticeably better)
* AHI.SetState() still works correctly (Problems were identified with it in previous versions of this release, but I think I fixed it)
* Context mode - It's possible that things that were flaky before may be better
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

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

17 Jan 2022, 12:15

AHI 0.7.0 has been released
https://github.com/evilC/AutoHotInterception/releases

The intention of this release is to clean up the AHI C# source code - apart from the few bugfixes mentioned in the changelog, nothing should have changed - you are encouraged to test and make sure I didn't balls things up.

This and the last release are both intended to pave the way for a proper fix of AHI's handling of Extended Keys (Particularly Numlock / Pause), which is what will be coming next.
eduardobedoya
Posts: 45
Joined: 05 May 2016, 14:02

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

08 Feb 2022, 14:48

Hi Mr evilC, this is only a tablet-mouse related script, I'd like to enable and disable a Wacom tablet and make it perform these tasks...
When I press X on keyboard only when Notepad is active, a GUI appears at the center of the screen with 9 progress bars (one on top of the other), then…
When I click the first progress bar of that GUI with the Wacom stylus tip and hold the click down, then…
1. Wacom stylus cursor should be "trans positioned", meaning while the physical stylus is clicking and holding down at the center of the screen (tablet), the cursor should also click, and hold down but in a specific coordinate at the side of the screen, not at the center.
2. then if the stylus is moved left or right while is still clicking down, then the cursor at the side of the screen should be moved as well, and the GUI should show that progress bar increasing or decreasing accordingly.
3. finally, the click made on the side of the screen should be released only when the stylus is released, at which time the cursor must be "re-aligned" with the position of the stylus at real time, meaning returning to the default behavior of the stylus.
4. The thing is, there are 9 progress bars that appear at the center of the screen when key X is pressed, and clicking on the second progress bar do the same as clicking on the first progress bar, but it clicks on a different coordinates, so each progress bar "transposition" the cursor to a different coords.
Hope you could tell me if this is actually feasible, I have installed AHI on my Windows 8.1 laptop and got it working, I have some knowledge of the AHK actions to move mouse, loops, set timer, functions, arrays, GUI.
If you could please mention the AHI functions needed for such task. Many Thanks in advance.
Geografia
Posts: 1
Joined: 26 Feb 2022, 07:06

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

26 Feb 2022, 07:33

Hello. I looked on the forum, but couldn't find it.
Is it possible to send a “key press”, with the help of the driver, to an inactive window?
successfulyams
Posts: 3
Joined: 27 Feb 2022, 14:45

How to know if 2nd keyboard caps lock on or off?

16 Mar 2022, 12:12

Is there any way to tell if capslock on my 2nd keyboard on or off? :D
payaAHK
Posts: 106
Joined: 30 Oct 2016, 15:28

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

08 May 2022, 06:22

hello
sorry but no way to use it.
i have this message from monitor.ahk:
---------------------------
Monitor.ahk
---------------------------
Unable to find C:\Users\ap\Downloads\AutoHotInterception\Lib\AutoHotInterception.ahk\..\x86\interception.dll, exiting...
You should extract both x86 and x64 folders from the library folder in interception.zip into AHI's lib folder.
---------------------------
OK
---------------------------

C:\Users\ap\Downloads\AutoHotInterception\Lib\AutoHotInterception.ahk\..\x86\interception.dll should never exist :?:
rather something like:
C:\Users\ap\Downloads\AutoHotInterception\Lib\x86\interception.dll ?
payaAHK
Posts: 106
Joined: 30 Oct 2016, 15:28

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

08 May 2022, 06:29

hello...
i reload last version and re copy the dll ... and it s working!
thanks

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 67 guests