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

Post your working scripts, libraries and tools
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 06:45

I copied interception.dll into the Lib directory and renamed it to AutoHotInterception.dll

The instructions make zero mention of renaming files. Why did you do this?
AutoHotInterception.dll comes in the zip file you download from my site, it is not the same as Interception.dll
haichen
Posts: 153
Joined: 09 Feb 2014, 08:24

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

29 Mar 2018, 08:02

Aaah.. I looked directly on https://github.com/evilC/AutoHotInterception - THERE I downloaded the whole zip extracted it and then i followed the Instructions on the github-site:
Setup
Download and install the Interception Driver
Download a zip from the releases page and extract it to a folder
Copy the interception.dll from the folder ..


Yours
Download from here
was much too big for me to see :lol:

I will try it again

Thanks
haichen
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 08:31

Yeah, unfortunately, I don't think I have any control over the "Clone or Download" link on the GitHub page.
So maybe I just need to make it clearer in the instructions that the main page is NOT the releases page?
haichen
Posts: 153
Joined: 09 Feb 2014, 08:24

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

29 Mar 2018, 08:38

I uninstalled the driver and Restarted Windows to start from the beginning.

Then I download the zip "Download from Here" and tried monitor.ahk: "Interception failed to load" ..
I reinstalled the driver (interception.dll - from the website in your readme.md) and after Windows restart i got "Interception Test failed".
No luck ..
Do i have to register your AutoHotInterception.dll?

May be a link in your ReadMe.md will help?
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 08:45

Right click each of the DLLs in the lib folder, select properties - are the files blocked?
If you are getting the test failed message, then it means it loaded Interception OK, but it could not load AHI OK, so I am guessing the AHI DLL is blocked.
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 09:02

I updated the readme to be a bit more clear, and I added some code to AutoHotInterception.ahk to instruct the user how to unblock the DLL.
It's not in a release yet, for now you can just replace your version of the file with this one.
haichen
Posts: 153
Joined: 09 Feb 2014, 08:24

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

29 Mar 2018, 09:14

I was a bit distracted. So I started again from beginning. This time very carefully. Uninstall the driver, restart Windows, install driver, restart Windows. Test Monitor.ahk from the release dir.
"Interception failed to load" .. Sorry for the wrong statement.
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 09:30

Well, as I said, likely cause is that AutoHotInterception.dll is blocked. Right-click it, select properties, if there is a checbox called "Unblock" then tick it.
haichen
Posts: 153
Joined: 09 Feb 2014, 08:24

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

29 Mar 2018, 09:33

If i use the renamed (to AutoHotInterception) interception.dll I got "Interception failed to load". And there's no unblocking in the properties in both tries.
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 09:40

DO NOT, EVER, RENAME ANY OF THE DLLs.
In the version of AutoHotInterception.ahk that is included, when it says "Interception failed to load", what it ACTUALLY meant is "AutoHotInterception.dll failed to load". I have now corrected this.
Unless it is in the properties menu like so, then no idea why it can't load the DLL
Image
Last edited by evilC on 29 Mar 2018, 09:48, edited 2 times in total.
phasermaniac
Posts: 71
Joined: 09 Apr 2017, 14:05

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

29 Mar 2018, 19:35

Hi, I'm the guy using ahk wrapper to support crt lightguns.
I'm moving to Autohotinterception as seems pretty much easier to code, but I need some help, I'm graphist, and I may have some basic errors coding, any help would be apreciated.

crt guns are absolute coords mouse devices, and have the same pid and vid, but they don't track over dark colors, so I use a program that flasher the screen for a custom amount of ms.
I use a supposed precision timer, that's why I write sleep().

So The main goal is to delay the trigger: I block the real click input, I simulate the flasher key, and then I simulate the click and I control its duration too, to be inside the flashing time ( important in some games).

I'm not very sure how to get all the devices id with the same hid pin, this part is not working in my code yet.

I also wanted to block mouse movement and only update it when the simulated click is down. This is working, but maybe not the best way.

On the otherhand I tried to send right click instead of left click whenever aiming offscreen. I'm getting x=0 y=0, but couldn't get it work

Basically I'm doing an exe that I launch with any game that needs it so I use a bat:

Code: [Select all] [Download] GeSHi © Codebox Plus

Start game.exe
Start TriggerDelayer.exe 15 60 block offscreen


TriggerDelayer.exe:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 20:37

Ah, I remember your use-case now - yeah I just bought a graphics tablet to experiment with, so now have a better picture of how it all works.
However, I discovered a potential problem with Interception Absolute mode and how AHI does things that might affect your use-case.
With my tablet, top left is top left of my left-most monitor.
Even if I pass through "strokes" from that tablet with Interception, still the same.
As soon as I create a new "stroke" with Interception, even if I send it from that tablet, top-left of the tablet is top-left of my main monitor.

I guess maybe something in the stroke that is not exposed at the API level governs this, not sure if it would be an issue for you.
The way AHI works now - you set something to block if you want to alter it, and synthesize a new stroke with the alterations.
So in order to conditionally block something, you need to always block it and conditionally forward it on.

Regarding multiple devices - currently there are no helper functions written for this yet - for example GetDeviceId will return the first id matching the VID/PID, which is not much use to you.
I did just change all the subscribe methods to use IDs though, so as long as you know the Interception IDs of each gun, you should be able to get it to work.
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

29 Mar 2018, 20:42

if (reload = offscreen && x=0 && y=0); HERE RELOAD, X AND Y VARS DONT WORK Is = in this case assignment, not comparison? You used brackets, so this will force expression syntax I think.
I think you want if (reload == offscreen && x==0 && y==0)

Parameter :=%A_Index% Double-dereference (you used both := and %var%)

STRANGE FOR ME, I HAVE TO SET ALL GLOBAL VARS Probably because you are using the variables inside a function?

All my code uses "expression syntax". I avoid the absolute hell out of the newbie syntax (%MyVar% and if this = that), I recommend you do the same
haichen
Posts: 153
Joined: 09 Feb 2014, 08:24

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

30 Mar 2018, 04:28

Hi
I added this to AutoHotInterception.ahk and run Monitor.ahk:

Code: [Select all] [Download] GeSHi © Codebox Plus

	catch e {
MsgBox, 16,, % "Exception thrown!`n`nwhat: " e.what "`nfile: " e.file
. "`nline: " e.line "`nmessage: " e.message "`nextra: " e.extra
}


I get :
---------------------------
Monitor.ahk
---------------------------
Exception thrown!

what:
file: C:\Users\***\Desktop\AHI\AHI\Lib\AutoHotInterception.ahk
line: 13 ;this.Interception := asm.CreateInstance("AutoHotInterception." cls)
message: 0x80131604 -
Source: mscorlib
Description: Ein Aufrufziel hat einen Ausnahmefehler verursacht.
HelpFile: (null)
HelpContext: 0
extra: CreateInstance
---------------------------
OK
---------------------------



Do this give an idea?
phasermaniac
Posts: 71
Joined: 09 Apr 2017, 14:05

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

30 Mar 2018, 05:45

I'm trying to use expression syntax as you said, but I'm having a problem that has nothing to do with this:
How I can play with x and y coords? If I put the tooltip out the mousemovement function, I get empty x and y vars.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by phasermaniac on 30 Mar 2018, 06:26, edited 1 time in total.
User avatar
gregster
Posts: 937
Joined: 30 Sep 2013, 06:48

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

30 Mar 2018, 05:57

phasermaniac, variables in functions are local, unless you define them as global. You can also introduce values as parameters to functions ( that's what you are doing in your MouseEvent function): https://autohotkey.com/docs/Functions.htm#Local
Last edited by gregster on 30 Mar 2018, 07:29, edited 1 time in total.
phasermaniac
Posts: 71
Joined: 09 Apr 2017, 14:05

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

30 Mar 2018, 06:31

thanks gregster, but if I make them global, I'm having the same problem:

Code: [Select all] [Download] GeSHi © Codebox Plus

MouseEvent(x, y){
global mx :=x
global my :=x
ToolTip % "x:" mx "`ny:" my ;WORKS HERE BUT NOT OUTSIDE
}
User avatar
gregster
Posts: 937
Joined: 30 Sep 2013, 06:48

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

30 Mar 2018, 07:26

One way:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by gregster on 30 Mar 2018, 07:50, edited 1 time in total.
User avatar
evilC
Posts: 4008
Joined: 27 Feb 2014, 12:30

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

30 Mar 2018, 07:39

AHI is not designed to be turning on/off subscriptions (or blocking) like you are trying to do.
Thinking about it, I am not sure if it would work or not.

Intended usage was to be calling SubscribeMouseMoveAbsolute ONCE, with block enabled.
When you want to "Allow" movement through, in MouseEvent, use SendMouseMoveAbsolute
When you want to "Block" the movement, do not use SendMouseMoveAbsolute

You are also calling other AHI methods too often.
Here, you should not be calling GetDeviceId - especially as you already have the ID!!

Code: [Select all] [Download] GeSHi © Codebox Plus

ButtonEvent(state){
Gun := Interception.GetDeviceId(true, VID, PID)
;ToolTip State: %state% device: %Gun%
if(state=1)
triggerDelay(Gun)
}

Also, VID and PID are out of scope

Return to “Scripts and Functions”

Who is online

Users browsing this forum: arcticir, DJ__Shiva and 18 guests