Giter Site home page Giter Site logo

autohotinterception's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autohotinterception's Issues

Disable cursor and read raw input from mouse, how to do it ?

Hi, sorry if I'm being ignorant but I'm only learning all these things. I'm trying to use AutoHotInterception and UCR to fully emulate the DualShock 4 controller in order to play games on the PS Now, which only supports official PS4 controller. My only problem is that when I use DeltaToAxis plugin with mouse as an input and DS4 right stick as output, the mouse is still visible and moves around the screen even though the controls work. It shows up the PS Now overlay, and simply hiding the mouse or trapping it in the middle of the screen doesn't solve the problem. So I was trying to disable the cursor completely and do something to catch the low-level mouse delta only. What must I do ?

Thanks,

Convert to using ConcurrentDictionaries

Not really a problem at the moment as we only have add subscription, but in order to remove subscriptions, we will need to move to the thread-safe ConcurrectDictionary class, as used in the IOWrapper DirectInput / XInput providers, else we could remove a dictionary while the PollThread is iterating the dictionary.

[Help Wanted] Problem with key remapping

When I try to remap one key to another (for example X::A) it works without problems. If I try to remap a key to something different (a MsgBox, a Tooltip,...) it doesn't works. For example, in this code:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
#Persistent
#include <AutoHotInterception>

AHI := new AutoHotInterception()

keyboardId := AHI.GetKeyboardId(0x1B4F, 0x9203)
cm1 := AHI.CreateContextManager(keyboardId)

#if cm1.IsActive	; Start the #if block
X::
MsgBox, Hi
#if

A message box should appear when i press "X" but nothing happens. If I try using Subscription:

#SingleInstance force
#Persistent
#include <AutoHotInterception>

AHI := new AutoHotInterception()

keyboardId := AHI.GetKeyboardId(0x1B4F, 0x9203)
AHI.SubscribeKey(keyboardId, GetKeySC("X"), true, Func("KeyEvent"))
return

KeyEvent(state){
	MsgBox, Hi
}

^Esc::
ExitApp

Everything works as expected. I don't know what could be the problem...

Keys not intercepted

Hello

I have a XP Pen Artist 15.6 Pro. My tablet is detected under keyboard in AutoHotInterception Monitor as HID\VID_28BD&PID_090D&REV_0000&MI_00&Col03 and also in mices but keys and mouse clicks are not detected even if I check everything.

Stroke is either wholly blocked or not blocked, and only one type of input is processed per stroke

There is only one block variable, causing the whole stroke to either be blocked or not.
A stroke can contain one or more of mouse button events, relative movement or absolute movement, but an if/else is used, so only one type of input will be processed per stroke

This causes the following issues:

  • When subscribing using block to mouse movement, mouse buttons are blocked, and vice versa
  • If multiple mouse buttons are subscribed, but eg only one is blocked, then all will be blocked

Each stroke needs to be split up into multiple strokes, and the if/else changed to multiple unrelated ifs

Ignore key up when using subscriptions

In an effort to retain performance for gaming, I've decided on using key subscriptions to avoid possible delays Contextual Hotkeys may cause on my main keyboard. But the key up being fired has created a bit of a roadblock for me.
Currently, it seems like I will have to add a check inside every single key's callback to suppress the key up event, since, for most hotkeys, I only want them firing once when tapped.
Obviously, that is pretty cumbersome and messy looking, which is why I would like to ask; Is there something I can do that I'm missing, or is it just something that hasn't been added?

Of course, I might not actually be avoiding possible delays in the first place, and in which case, I could probably just use contextual binds. I just prefer the way functions look/behave in most cases.

Stuck Keys

I have remapped all modifier keys with AHI, for instance Alt is Ctrl now. But too often I get stuck keys, pressumably when pressing multiple modifier keys at the same time.
Could it be that AHI's ability to block inputs is causing this? E.g. when a key is physically released while the input is blocked.

AHK v2 compatibility

I'm curious if this will be updated to be compatible with AHK v2, which is drawing ever closer to being the primary version.

It is actually possible to be compatible with both v1.1 and v2 if you make sure to use syntax and commands that work with both versions, as seen here: https://github.com/mmikeww/AHKv2-Gdip

Help!Context mode have a big BUG!

Sometimes,it can't blocked.
For example,I give "z" a function,then I test it in Word.However,sometimes it still send "z".
My script and screenshot ↓↓↓

#SingleInstance force
#Persistent
#include C:\AutoHotInterception\Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

id1 := AHI.GetKeyboardId(0x258A, 0x001F, 1)
cm1 := AHI.CreateContextManager(id1)
return

#if cm1.IsActive

z::
send O
return

#if

image
Please help me fix the problem,I'm very grateful.

Bonus: UAC override

An advantage worth mentioning is that it can trick UAC; the windows admin security check. There are many more advantages, that aren't obvious. Should add those in the description/doc.

Can I use this to record key's sequence entered from specific keyboard?

I am pretty new to AHK script. I very appreciate the wonderful work you did.
I try to record the sequence of certain keys entered from a specific keyboard, and block them at the same time using the following code

#SingleInstance force
#Persistent
#include Lib\AutoHotInterception.ahk

global AHI := new AutoHotInterception()
keyboardId := AHI.GetKeyboardId(0x5131, 0x2007)
str := ""
keys := ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Enter", "?", ";"]
Loop 13 {
    name := keys[A_Index]	
    AHI.SubscribeKey(keyboardId, GetKeySC(name), true, Func("KeyEvent").Bind(name))
}
KeyEvent(name, state){
    global str
    if(state == 1){
       return
    }
   if(name != "Enter"){
	str .= name
   } else {
	xx := str
	str := ""
	MsgBox % xx		
   }
}

^Esc::
   ExitApp

Most time I got the right sequence, but sometime the "Enter" key won't be blocked.
Sometime I got the wrong sequence, like I enter 123456, it shows me like 213456.
That means the KeyEvent not firing in order.

I don't know what to do now, or maybe you have a better idea to implement the purpose mentioned at the beginning.

Thanks a lot

Mouse Wheel events

For Mouse Wheel events, the parameter will be 1 for Wheel Up / Right and -1 for Wheel Down / Left

Wheel Up and Wheel Right is working fine, however Wheel Down And Wheel Left are behaving like up and right.

the problem is with states, they are only 0 and 1 for both.i had to write another functionfor the states.

getButtonState(KEY, STATE) {

if(KEY = WheelDown OR KEY = WheelLeft) {

if(STATE = 0)
	return 0
else 
	return -1
}

}

Hello evilC,How to change the below context script to subscription script?

I'm sorry to bother you again.
How to change the below context script to subscription script?
(Only subscription,not combined.Thanks)

#SingleInstance force
#Persistent
#include C:\AutoHotInterception\Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()
id1 := AHI.GetKeyboardId(0x1C4F, 0x0002, 1)  
cm1 := AHI.CreateContextManager(id1)

id2 := AHI.GetKeyboardId(0x258A,0x001F, 1)   
cm2 := AHI.CreateContextManager(id2)
return

#if cm1.IsActive

z::
send A
return

#if


#if cm2.IsActive

z::
send O
return

#if

GetDeviceIdFromHandle missing from Manager / Monitor

GetDeviceIdFromHandle in AutoHotInterception.ahk calls GetDeviceIdFromHandle in the C# code:
dev := this.Instance.GetDeviceIdFromHandle(IsMouse, handle, instance)
This no longer exists in the Manager / Monitor class, as it was moved to HelperFunctions.cs

SendKeyEvent does not work for arrow keys

Reported in UCR thread by malcev

The following code in SendKeyEvent seems to be breaking sending of Up Arrow:

           if (code > 255)
            {
                code -= 256;
                state += 2;
            }

Commenting it out resolves, but I think this is needed to allow sending eg of Right Alt.

The v0.3.7 release is messed up

  1. If running x64 version of AHK it will fail.
    "You should extract both x86 and x64 folders from the library folder in interception.zip into AHI's lib folder."
    There is no x64 folder in the zip file, only an x86 one so either need to change how interception searches for dlls or the folder needs to be created (and a 64bit dll placed in it).

  2. There is an "interception.dll" in the base Lib folder inside the zip, unfortunately it also is x86. So there are no x64 dlls included in the current release,

Sending special characters via callback

Some of the macros I make are to create shortcuts to special characters such as ✔. (Don't know the technical term for them)
But currently those characters don't seem to send correctly from within a callback. For example that tick comes out as ✔ when using any of the sending options available in AHK.

I don't really know enough about character formatting and inputs to guess why it'd be happening, but here's a script I made to reproduce it.

#SingleInstance, Force
#Persistent
#Include Lib\AutoHotInterception.ahk

AHI := new AutoHotInterception()

; Use your keyboard's handle
AHI.SubscribeKey(AHI.GetKeyboardIdFromHandle("HID\VID_03F0&PID_0024&REV_0130"), GetKeySC("F1"), true, Func("CallbackFunction"))

CallbackFunction(state) {
    If !state
        Return

    SendInput, ✔
}

I'd be interested in any workaround if you know of one.

External Mice stopped working

I had an external USB and Bluetooth mouse and both stopped working. Since this happened within the timeframe I assume it's because of AHI, or rather the Inception driver.
I tried to fix it with the usual approach: on/off, reboot, unplug, uninstall. No luck so far.
When I turn the mice on/off they popup in Device Manager as HID-compliant mouse, but don't work, and are not shown in Monitor.ahk.

Support multiple identical devices (Same VID/PID)

We currently have a tentative system in IOWrapper/UCR, but experimenting here "closer to the metal" may give me a chance to perfect something in AHI and then port it into IOWrapper.
A temporary triage would be to add endpoints to select not via VID/PID, but via Interception ID

Pass back x/y of click in Absolute move subscriptions

Both button and move data can be present in mouse updates, especially in Absolute mode.
At the moment, when a click happens, the coordinates of that click are never passed back via a callback, because State is first checked, and if non-zero, movement is never processed.

Two solutions seem possible:

  1. Move to passing a more stroke-like object instead of just state or x/y
  2. Remove the ELSE clauses from the checks in the mouse processing loop, and process movement before clicks.

UnsubscribeMouseMove disables mouse input...

I've encountered an issue where "UnsubscribeMouseMove" disables mouse input when I suppose its intended behaviour is just to "unsubscribe" the callback?

class Example {
        static device := {}
        __New(keyboardHandle, mouseHandle) {		
		this.AHI := new AutoHotInterception()

		this.device.keyboardId := this.AHI.GetKeyboardIdFromHandle(keyboardHandle)
		this.device.mouseId := this.AHI.GetMouseIdFromHandle(mouseHandle)
	}	
        blockMouseInput(block := false) {		
		this.AHI.SubscribeMouseMove(this.device.mouseId, block, ObjBindMethod(this, "__eventCallback", block))
		return this
	}
	
	unsubMouseInput() {		
		this.AHI.UnsubscribeMouseMove(this.device.mouseId)
		return this
	}
	
	__eventCallback(block, x, y) { 
		; ... empty fn
	}
        ...
}
Example.blockMouseInput(true) ; this would subscribe to mouse movement and block at the same time -> works as intended
Example.blockMouseInput(false) ; this would subscribe to mouse movement, but NOT BLOCK the mouse input -> works as intended


Example.unsubMouseInput() ; THIS IS SUPPOSED TO "Unsubscribe" from mouse movement and remove any block associated with it, YET it disables mouse movements completely (i.e locks out your mouse) and Example.blockMouseInput(false) or Example.blockMouseInput(true) wouldn't bring it back until you exit/reload the script...

I thought it was an intended behaviour at first, but after checking "SubscribeKey" to see if it acts similarly - it doesn't - after using "UnsubscribeKey" I can still use that key normally.

Check for existence of Interception.dll

If the user does not place interception.dll in the lib folder, they get an error message "Could not load AutoHotInterception.dll", which is not very helpful.
Add a check for the file in the wrapper

Add discovery tool

Give users some way to discover VID/PID etc.
Also should maybe show type of input seen - eg keyboard key, mouse button, mouse movement (relative / absolute)

Stuck Shift key on successive keystrokes

pressButtons(sKey, sflag) {
    keys := StrSplit(sKey, "")
    if (sflag == "Up") {
      keys := ReverseArray(keys)
    }
    for i, k in keys {
      key := k
      if (key == "^") {
        StringReplace, key, key, ^, Ctrl
      }
      if (key == "!") {
        StringReplace, key, key, !, Alt
      }
      if (key == "+") {
        StringReplace, key, key, +, Shift
      }
      if (key == "#") {
        StringReplace, key, key, #, Win
      }
      if (key == A_Space) {
        StringReplace, key, key, %A_Space%, Space
      }
      AHI.SendKeyEvent(KEYBOARD, GetKeySC(key), sflag == "Down" ? 1 : 2)
    }
}

sKey = "+a"
sflag = "Down""Up"
I catch a bug in press Shift(press) -> a(press) -> a(release) -> Shift(release)
Shift button Stucked after
Why?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.