In what topic? You mean when trying to unload the monitor, or unsubscribing?
Unsubscribing would be easy - all subscriptions are held in a Dictionary (array), I would just need to delete the subscription from the array.
AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
-
- Posts: 137
- Joined: 01 Jul 2017, 03:04
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Sorry, I'm using an translator, no speak english. I mean AutoHotInterception generally.In what topic?
I mean unload dll.including the instance itself.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
The AHK classes are not designed to be disposed, but you could maybe call Dispose() on the instance inside the AHK wrapper
eg MonitorWrapper.Instance.Dispose()
That will kill the Monitor's poll thread and stop it filtering input.
https://github.com/evilC/AutoHotInterce ... or.cs#L140
eg MonitorWrapper.Instance.Dispose()
That will kill the Monitor's poll thread and stop it filtering input.
https://github.com/evilC/AutoHotInterce ... or.cs#L140
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
AHI 0.3.6 has been released, with a fix for sending Right Shift (Code 310)
-
- Posts: 1
- Joined: 26 Sep 2018, 12:55
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
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
the hardware I have is this:
https://www.amazon.in/VR-Case-Bluetooth ... 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.
THE PROBLEM
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:
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...
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
the hardware I have is this:
https://www.amazon.in/VR-Case-Bluetooth ... 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.
THE PROBLEM
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:
Spoiler
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:
Spoiler
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...
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
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?
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?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
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:
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
#Persistent
#include Lib\AutoHotInterception.ahk
AHI := new AutoHotInterception()
keyboardId := AHI.GetKeyboardId(0x04F2, 0x0112)
AHI.SubscribeKey(keyboardId, GetKeySC("1"), true, Func("KeyEvent"))
return
KeyEvent(state){
; Start repeat suppression
static lastState :- 0
if (state == lastState)
return
lastState := state
; End repeat suppression
ToolTip % "State: " state
}
^Esc::
ExitApp
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Well oof. That's gonna be a big 'my bad' on that one. I made a function that automatically subscribes keys that are in an array and completely forgot you defined the callback yourself. Disregard this.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
It seems like I completely fail to find any devices.
GetDeviceList() gives me nothing and Monitor.ahk shows an empty GUI.
I am on Win 7.
Can someone help?
Thanks.
GetDeviceList() gives me nothing and Monitor.ahk shows an empty GUI.
I am on Win 7.
Can someone help?
Thanks.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Did you install interception? Did you unblock the dlls?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Ah ye, I didn't unblock these dlls (unblocked wrong one actually) Sorry, my fault.
Anyway, now I would like to use it, only thing I wanna do is being able to block/unblock mouse movement for one old game.
What is the easiest way to do that?
I tried this and it doesn't work.
It gave me an error: "Can not implicitly convert type Void to object"
My understanding of this is very low (I am new to AHK) so I guess that I am doing something very wrong here, advice would be very helpful.
Thanks
Anyway, now I would like to use it, only thing I wanna do is being able to block/unblock mouse movement for one old game.
What is the easiest way to do that?
I tried this and it doesn't work.
Code: Select all
#Persistent
#include Lib\AutoHotInterception.ahk
AHI := new AutoHotInterception()
global Interception := AHI.GetInstance()
mouseId := Interception.GetMouseId(0x0458,0x003A)
~f::
Interception.SubscribeMouseMove(mouseID, true, Func("MouseEvent"))
return
My understanding of this is very low (I am new to AHK) so I guess that I am doing something very wrong here, advice would be very helpful.
Thanks
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
I would copy the examples that come with it, I don't know why you are calling methods directly on the C# instance, when it is intended for you to be calling the methods on the AHK wrapper (AHI).
ie mouseId := Interception.GetMouseId(0x0458,0x003A) should probably be mouseId := AHI.GetMouseId(0x0458,0x003A)
Per-app mappings is only supported in Context mode, which does not support mouse movement.
In order to do what you want, you would have to either:
Subscribe / Unsubscribe as the app became active / inactive
or
When the app is inactive, use AHI.SendMouseMove to forward on the movement.
Either way, as the notes say, be careful, I advise having a 2nd mouse handy
ie mouseId := Interception.GetMouseId(0x0458,0x003A) should probably be mouseId := AHI.GetMouseId(0x0458,0x003A)
Per-app mappings is only supported in Context mode, which does not support mouse movement.
In order to do what you want, you would have to either:
Subscribe / Unsubscribe as the app became active / inactive
or
When the app is inactive, use AHI.SendMouseMove to forward on the movement.
Either way, as the notes say, be careful, I advise having a 2nd mouse handy
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Ok, I made this simple testing script but still getting the same error: "Can not implicitly convert type Void to object"
Code: Select all
#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk
AHI := new AutoHotInterception()
mouseId := AHI.GetMouseId(0x0458,0x003A)
AHI.SubscribeMouseMove(mouseID, true, Func("MouseEvent"))
MouseEvent(x,y){
ToolTip % "TEST"
}
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Ah, it seems like I made a bit of a mistake when doing one of the wrappings.
For now, you can use AHI.SubscribeMouseMoveRelative(mouseID, true, Func("MouseEvent"))
It will be fixed in the next release.
For now, you can use AHI.SubscribeMouseMoveRelative(mouseID, true, Func("MouseEvent"))
It will be fixed in the next release.
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Ye, it works now. Thanks.
Btw, could you please clarify how to unsubscribe?
Btw, could you please clarify how to unsubscribe?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Oh and another thing: Why does it block mouse buttons as well? I thought it is supposed to block only movement, no?
EDIT: Nevermind I've found a solution if I use:
It blocks the movement but allows to use mouse buttons, but is there some "better" way?
EDIT: Nevermind I've found a solution if I use:
Code: Select all
AHI.SubscribeMouseMoveRelative(mouseID, true, Func("MouseEvent"))
AHI.SubscribeMouseButton(mouseID, 0, false, Func("MouseEvent"))
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
hello. I am russian. Try to configure AutoHotInterception. But it not working.
My Steps in virtual machine Win7 x64:
1) install AHK AutoHotkey_1.1.30.01_setup.exe. x86 verion.
2) Download Interception and install it. | https://github.com/oblitum/Interception/releases/ 3) Reboot
4) Download AutoHotInterception, copy Interception.dll to lib folder and Check unlock in DLL files: | https://github.com/evilC/AutoHotInterception/releases 5)run Monitor.ahk I am always get this error - Check Failed. Try it on Win7(x64) and Win XP(x86).
What is not correct?
I just need to send keyboard keys like this https://www.autohotkey.com/boards/viewtopic.php?t=27007. Can AutoHotInterception to help with this?
My Steps in virtual machine Win7 x64:
1) install AHK AutoHotkey_1.1.30.01_setup.exe. x86 verion.
2) Download Interception and install it. | https://github.com/oblitum/Interception/releases/ 3) Reboot
4) Download AutoHotInterception, copy Interception.dll to lib folder and Check unlock in DLL files: | https://github.com/evilC/AutoHotInterception/releases 5)run Monitor.ahk I am always get this error - Check Failed. Try it on Win7(x64) and Win XP(x86).
What is not correct?
I just need to send keyboard keys like this https://www.autohotkey.com/boards/viewtopic.php?t=27007. Can AutoHotInterception to help with this?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Did you run unblocker.ps1 as admin?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
I think that powershell is too old in my winrtual machine with Win7 and have not command Unblock-File:
ObjectNotFound: (Unblock-File:String) [], CommandNotFoundException
Win XP have not powershell.
What environment is necessary to use AutoHotInterception? Win 7 ... ?
Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
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.
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.
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: NinjoOnline and 181 guests