VL.IO.MouseKeyGlobal

A global mouse and keyboard hook for vvvv gamma. In contrast to the GlobalHook stuff posted in the forum and the chat beforehand this package is not based on MouseKeyHook but on SharpHook by Tolik Pylypchuk.

After some deliberation I chose Sharphook because:

For more info please check:
https://sharphook.tolik.io/v3.1.1/articles/intro.html

To use latest version, install via nuget

nuget install VL.IO.MouseKeyGlobal

Edit:

Latest version (1.3.0) supports keyboard simulation.

9 Likes

I gave it a go and a lot of nodes are red over here, am I missing something?

Explanation Overview of available nodes.vl-Application_2022.09.17-21.42.28

Unbenannt

Forgot to add the dependency on SharpHook to the nuspec… Should be fixed with the upcoming version. For now you have to install the dependency manually.

Hi bjoern,

thanks for your contrib! I am patching a touch keyboard, but I am struggling with @ and space
image

Rcontrol+Alt+Q just gives me “q” s. I also tried LControl and Control - same.

also funny: Shift+OemMinus does not work, but LShiftKey+OemMinus does.
image

And “Space” does not work at all for me.
Any hints? It seemed to me you already did something similar :)

Works here:
At
Spacegif

Edit: The bang doesn’t register in the gif but is also working.

hm seems the issue lies with my typewriter mod. your contrib works for the original one, if the window is selected…

Only change I made was inputting the observables from keyboard (io.global) directly into the sampler. image

other keys not working: ´´^²³{[]}~|
QWERTZ here, so basically all AltGr combinations and some other ones.

any Idea why this could happen? my physical keyboard and keyboard simulator result in the same “keypresses”
image

Can’t tell from looking at screenshots.

I also changed the categories of my typewriter mod for it to not interfere with the original one.

test.zip (129.1 KB)

Looks like Sharphook (or most likely rather the underlying libuiohook) is returning the key events in the “wrong” order.
EventOrder

Hey, thx for having a look at it!

I suspected something like this, but I just checked with the global.io.keyboardstate for both keyboard and global hook simulator input. Your keyboardstate shows the same key order for both input methods.

Comparing system.keyboardstate with global.io.keyboardstate shows the reverse keypress order coming from the keyboard simulator… I tried inputting the reverse order, but it did not solve the problem.

hook

Did you manage to do triple keypresses?

Dug a bit deeper and turns out I was looking in the wrong place. Unfortunately there is nothing I can do about the issue. But you can work around it by using a non-german keyboard layout :)

lol, the best error for my task at hand ^^
hey, thanks a lot for investigating and opening up the issue!

ok I worked my way down dependency hell, and posted the issue.

https://github.com/TolikPylypchuk/SharpHook was updated to latest libuiohook recently.

Maybe this resolves the issues with triple key shortcuts!

Helloww,

I have been playing with the contrib a bit today to try and replace my own snippets I had done with MouseKeyHook, and ran into a couple of funny things.

Can any of you reproduce the behaviours illustrated in the attached patch?

Problem #1
IsKeyDown and IsKeyPress react on different set of keys only; while IsKeyUp works with them all

Problem #2
There is a inconsistency between my keyboard’s output and the key detected out of KeyboardState, which makes it very difficult to ensure consistency across users if I need to match a specific key.
Interestingly, the detected key out of KeyboardState is different from what is typed in any text field in vvvv (which is consistent with my physical key on my keyboard).

Thanks for your feedback and thoughts!
T


xp-IO.MouseKeyGlobal_20241028.vl (23.6 KB)

Problem #1

Afaict this is standard windows behaviour and Skia keyboard behaves exactly the same. Unfortunately official documentation on this is sparse. Here is a SO question touching on that topic.

Problem #2
This is also “normal”. If you need the actual character you can get it from the KeyPress event.

image

xp-IO.MouseKeyGlobal_20241029.vl (36.6 KB)

1 Like

Problem #1

Afaict this standard windows behaviour and Skia keyboard behaves exactly the same. Unfortunately official documentation on this is sparse. Here is a SO question touching on that topic.

Yes, it seems to be expected behaviour indeed, as kindly pointed to me by @sebescudie:

- KeyDown Event: The KeyDown event occurs when a key on the keyboard is first pressed down. This event is raised for both non-character and character keys, including modifier keys (e.g., Shift, Control) and special keys (e.g., arrow keys, function keys). The event is raised before the character input is processed, which means it can be used to detect non-character keys or handle key combinations (e.g., Ctrl+C for copy).
- KeyPress Event: The KeyPress event is raised for character keys only, such as letters, numbers, and symbols. It occurs after the KeyDown event and before the KeyUp event. The event provides a KeyPressEventArgs object that contains the character representation of the key that was pressed. This event is suitable for handling input that involves actual characters, like text input in textboxes or other text controls.
- KeyUp Event: The KeyUp event is raised when a key on the keyboard is released. This event is triggered for both non-character and character keys, similar to the KeyDown event. It occurs after the KeyPress event and can be used to detect when a key has been released after being pressed down.

Problem #2
This is also “normal”. If you need the actual character you can get it from the KeyPress event.

Thanks a lot for the snippet!
Would definitely be worth adding to the help patch ;)