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

Post your working scripts, libraries and tools
Posts: 45
Joined: 01 Jul 2017, 03:04

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

11 Jul 2018, 05:23

In what topic?
Sorry, I'm using an translator, no speak english. I mean AutoHotInterception generally.
including the instance itself.
I mean unload dll.
Posts: 1
Joined: 26 Sep 2018, 12:55

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

26 Sep 2018, 13:47

Hello, I'm new in programming in general and I need to map a mouse device to be used like a joystick or mapped to a keyboard button.

What I want:
I want to use a bluetooth mouse to work as a joystick or to emulate key presses using the delta from the mouse.

I want to use this as a controller for a game (GzDoom) that support joysticks or keyboard for movement. Because I also have a giroscopic mouse for the aiming I need to block the signal from the mouse movement on the system so I can use both mices one for movement and one for aiming.
I don't want to configure the giroscopic mouse because it's working fine for aiming.

the hardware I have is this: ... B01GMDAD1Y
This is a bluetooth controller for an android device, most of it's buttons are connected to some keys that are not mapped to normal keys:
- rewind
- fast-forward
- volume up / volume down
- home
- something else I don't remember (Tap me thinks).

Now some of it's buttons are not even recognized by windows, so i can't use the buttons for mapping to the directional keys on the keyboard, which is what I tried first (only 2 of them are functional the others are not even being recognized as keys when I try to detect the key codes).
this device also have a mouse function that works when pressing at the same time the @ button and the power button, and it's detected by the system as a mouse device.

It can emulate pure axis movement, meaning that if I move the stick in one direction only the delta on that direction changes, so it's easy to use as a joystick or a mouse. it also doesn't have a VID/ PID number so It's have been only recognized by it's handler.

I have found EvilC Warper for Interception and I have managed to program a script to map the delta to keys, it works but I don't know how to program the return to 0 on the delta of the mouse, so it stops moving when I stop pressing the handle.

I have tried using UCR to map the mouse delta to a vjoy device with the plugin that comes with this program. This works, but it have problems:
When I configure the device to work with both axis X,Y one of the axis never work (one of the axis can only move to max or min and stays there, but the other works)
If I configure the device to use a single axis the plugin works as intended. I have tried using different profiles for each axis but this present the same problem. one of the profiles works fine an the other always have max/min values.

I have also tried with the old version of UCR, now this works fine, in fact it works very well, but I couldn't find a way to disable the mouse movement. I don't know if it's even possible to do it with the old UCR.

this is the new UCR log:
If possible I would want to use UCR for doing this because of it's funcionality or if it's not possible then how can I program the stop from the mouse on interception, I have seen a script that evilC write on AHK for mouse to keys movement on an old thread on the forums of AHK, but is not using interception, I have tried to program something on interception but I can't conceptualize how is gonna listen to an event that doesn't exists and needs to be created by AHK.

this is my script:

If this can't be solved then I will try to buy another "bluetooth joystick" and try to not get scammed by the sellers again...
Posts: 1
Joined: 29 Oct 2018, 23:27

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

29 Oct 2018, 23:41

With AHI, is it possible to run a script only when a button specific is released? What about when a button is initially pressed?

My context:
I want to use a 2nd keyboard as a smart medication box - I will remove almost all the keys, stick a flat surface onto each remaining key, and place my medication boxes on these surfaces. That way, when I take my meds, I remove the medication from the board, which updates a database. Same for when they're returned onto the board (which makes sure I haven't taken the box but forgotten to take the meds). I used Taran's system, but holding a key basically ran the intercept script many times per second - both visually annoying (cmd running repeatedly) and inefficient. Does AHI have the capacity to handle this problem?
User avatar
Posts: 4354
Joined: 27 Feb 2014, 12:30

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

30 Oct 2018, 05:13

Yes it is possible to do this, but it sounds like that is not actually what you want.
Running a new AHK script on each press or release of each key is not the way to go in this instance.
You want one AHK script which reacts to keys in the same way that the sample AHI scripts do.
If a key is held and is repeating, then simply filter out the repeats.

Here is an example of repeat suppression:

Code: Select all

#SingleInstance force
#include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

keyboardId := AHI.GetKeyboardId(0x04F2, 0x0112)
AHI.SubscribeKey(keyboardId, GetKeySC("1"), true, Func("KeyEvent"))

; Start repeat suppression
static lastState :- 0
if (state == lastState)
lastState := state
; End repeat suppression
ToolTip % "State: " state


Return to “Scripts and Functions”

Who is online

Users browsing this forum: gwarble and 36 guests