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

Post your working scripts, libraries and tools
OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

17 Apr 2018, 15:36

if i just run the script normally i get no error but if i open it in scrite turn on debug mode and hit f11
i recorded it and upped it to sendspace https://www.sendspace.com/file/so2qew
Last edited by OCP on 20 Jun 2018, 03:16, edited 1 time in total.
OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

17 Apr 2018, 15:47

no hurries i am off to bed soon i hope i am not the only one giving you headache stuff :) take it easy i have no hurry
Last edited by OCP on 20 Jun 2018, 03:16, edited 1 time in total.
OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

18 Apr 2018, 07:59

i was wondering could it be you are on win10 (i dunno if you are) and me on win7 and that the code needs to be different depending on system?
Last edited by OCP on 20 Jun 2018, 03:16, edited 1 time in total.
User avatar
evilC
Posts: 4337
Joined: 27 Feb 2014, 12:30

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

18 Apr 2018, 10:30

Yes, I am on Win10.
The underlying code that does most of the heavy lifting is .NET, so I guess it could depend on what version of .NET you have installed.
AHI currently targets .NET 4.6.1, although I could probably drop that lower.
OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

18 Apr 2018, 11:57

i see i have v4.7.1

if i delete or remove the interception.dll i do get that error saying autohotinterception.dll failed to load so i think that the interception.dll is working just not the other dll

what if i install 4.6.1
Last edited by OCP on 20 Jun 2018, 03:16, edited 1 time in total.
OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

22 Apr 2018, 14:52

hi thnx for the update

i no longer get a bug report in or outside scrite so it should be working but i still get a empty monitor gui you have any ideas what i could do?
Last edited by OCP on 20 Jun 2018, 03:15, edited 1 time in total.
User avatar
evilC
Posts: 4337
Joined: 27 Feb 2014, 12:30

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

23 Apr 2018, 13:36

@OCP, I think I may have worked out what it is.

https://support.microsoft.com/en-gb/hel ... in-windows

It seems that if you build .NET code on VS2015 or later (Which I do), then this targets the "Universal C runtime", which your old WinXP system will probably not have.
You can get an update for Win7 and later, but not XP.
I will ask around and see if I can maybe build a copy that works with normal .NET or something, even if just to satisfy my curiosity as to why it doesn't work for you
User avatar
evilC
Posts: 4337
Joined: 27 Feb 2014, 12:30

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

23 Apr 2018, 14:02

Now that with AHI we can make a 2nd keyboard totally independent of the 1st keyboard, my mind got to thinking of how you could take advantage of that.
I got to thinking about hotstrings - normally hotstrings have certain limitations because you are trying to preserve the normal functionality of the key, whilst also allowing hotstrings. But with AHI, we no longer care about the normal functionality of a key that is used as part of a hotstring, meaning AHK's built-in hotstring system is hamstrung by limitations that are no longer relevant.
So I started to write my own.

The ultimate goal is to provide on-screen cues to help guide the user through the hotstrings. ie if you have two hotstrings "aaa", "abc" and "aac", then typing "a" should show all three, if you type "aa" it should show "aaa" and "aac" etc, along with showing a hint as to what these hotstrings actually do.

In addition to hotstrings, my thought was to write my own equivalent of AHK's Input command for AHI, so you could do keyboard-specific input of arbitrary text.
For example, let's say you are playing a flight simulator and want to control the angle of the flaps.
You would have a hotstring FL, which would then trigger an input, which would wait for you to type a number and hit ENTER.
So to set flaps to 50% would be FL50<ENTER>

This would also transfer to other use-cases, eg in an art package you could have OP75<ENTER> to set Opacity to 75%, or even maybe <F1>ARIAL<ENTER> to set font to Arial

I managed to get *something* working, but I kind of lack inspiration to progress, so I am posting it here in the hopes that maybe some of the community can come up with some ideas as to how it should work.

This demo has two hotstrings
VO<NUMBERS><ENTER> = Set Volume
BR<TEXT><ENTER> = Launch browser, <TEXT> is looked up in the browserChoices array.

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

OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

23 Apr 2018, 15:26

hi thnx for the posts, i am on win 7 btw ok now i go read it all :)
Last edited by OCP on 26 Jul 2018, 22:42, edited 1 time in total.
OCP
Posts: 77
Joined: 28 Mar 2018, 19:28

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

24 Apr 2018, 04:21

hello

i tried updating but it says i already had that update for .net, i seam to be the weird case here :) perhaps something is just wrong with my current windows installation something i cant go into at this point i am to invested in my current installation for now anyway.

i am thinking if i should just buy me a programmable keyboard for my 65 hotkeys or wait until i have upgrade money for a new pc and then go this route again

anyway if i can help you in any way testing something over here just let me know i keep an eye on this thread
Last edited by OCP on 20 Jun 2018, 03:15, edited 1 time in total.
malcev
Posts: 94
Joined: 12 Aug 2014, 12:37

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

16 Jun 2018, 08:00

I have PS/2 keyboard and monitor.ahk does not recognize it.
Does your wrapper work with PS/2 devices?
And second question:
Why if I use usb keyboard I can not send scancode which consists of 3 digits?
For example sc148 - Up.
crumbl3d
Posts: 3
Joined: 23 Jun 2018, 17:01
GitHub: crumbl3d

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

23 Jun 2018, 17:15

Is it possible to get device id (Interception ID) after the script is loaded? I can't even get it to work inside a function, only works globally. I need a way to get device id on WM_DEVICECHANGE message and to subscribe to the mouse wheel event from the specific USB mouse. One idea I had is to reload the script every time but those messages are very common so I think it is a very hacky hack...

EDIT: I'm an idiot... Of course I forgot to declare global AHI object inside the function... I am so used to C/C++ and other languages I completely forgot I needed to redeclare the global variables. :P
Last edited by crumbl3d on 24 Jun 2018, 04:41, edited 1 time in total.
crumbl3d
Posts: 3
Joined: 23 Jun 2018, 17:01
GitHub: crumbl3d

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

23 Jun 2018, 17:21

malcev wrote:I have PS/2 keyboard and monitor.ahk does not recognize it.
Does your wrapper work with PS/2 devices?
And second question:
Why if I use usb keyboard I can not send scancode which consists of 3 digits?
For example sc148 - Up.

I'm also wondering if this is doable. I'm using a laptop so the keyboard is being reported as a PS/2 keyboard but apparently no valid VID/PID. It would be great if I could use this to remap the embedded keyboard buttons which are not accessible by AutoHotKey.
malcev
Posts: 94
Joined: 12 Aug 2014, 12:37

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

24 Jun 2018, 15:07

crumbl3d, I think, that it is a bug of this version of autohotkey wrapper.
You can use this one:
https://autohotkey.com/boards/viewtopic.php?f=5&t=26306
User avatar
evilC
Posts: 4337
Joined: 27 Feb 2014, 12:30

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

25 Jun 2018, 06:31

@malcev - AFAIK VID/PID is a USB concept, so PS/2 devices will not have one.
IIRC Intercept (The other wrapper you linked) does not filter by specific VID/PID, by default it filters every device.
ie it just uses the default "Predicate", which matches everything.
set_filter(context, "keyboard","FILTER_KEY_ALL|FILTER_KEY_E0|FILTER_KEY_E1")
if is_keyboard(device)
For this reason, it may see PS/2 input, whereas AHI would not. (Because AHI only hooks what you tell it to, and there's currently no way to tell it to hook PS/2 devices)

If this were the case, then altering AHI to allow subscribing to PS/2 devices would probably also be possible.

@crumbl3d - If you wanna have a play around with the AHI source and see if you can see input coming from the PS/2 device - I guess it maybe has no VID/PID, but may still have an ID or something.
I am away on holiday until Fri 29th FYI, and I can probably lay my hands on a PS/2 keyboard for testing on the following Monday.
Last edited by evilC on 25 Jun 2018, 06:59, edited 1 time in total.
User avatar
evilC
Posts: 4337
Joined: 27 Feb 2014, 12:30

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

25 Jun 2018, 06:54

@crumbl3d: This is where AHI decides whether to filter a device or not:
https://github.com/evilC/AutoHotInterce ... er.cs#L347

If using a PS/2 keyboard, set it to return true if device < 11, which will filter all keyboards. Just don't set it to always return true, as then all keyboard and mouse input would lock up while you debug ;)
If the PS/2 device is gonna work, you would then see input start coming in from it in PollThread()

As I said, I guess that maybe PS/2 devices have no VID/PID, but do get assigned an ID. So I guess that all we need is an alternative for GetKeyboardId/GetMouseId that works with PS/2 devices
malcev
Posts: 94
Joined: 12 Aug 2014, 12:37

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

25 Jun 2018, 22:25

PS/2 has ID.
http://download.microsoft.com/download/ ... devids.txt
Why if I use usb keyboard I can not send or remap scancode which consists of 3 digits?
For example sc148 - Up.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 16 guests