Page 1 of 1

[keyboard] - differentiate between different keyboards

Posted: Sun Sep 17, 2017 1:22 pm
by dequi
Is there an existing way to differentiate between key-presses by origin? like I have 2 (or more) keyboards connected to a pc and want only the key-press from keyboard B launch a macro same key-press on keyboard A should be ignored.
something like http://www.hidmacros.eu/
does the missing keyboard+ plugin do that?

Re: [keyboard] - differentiate between different keyboards

Posted: Sun Sep 17, 2017 2:42 pm
by kgschlosser
no it does not. in order to be able to tell where the keystrokes are coming from you need to have a kernel mode driver to do this.

Re: [keyboard] - differentiate between different keyboards

Posted: Sun Sep 17, 2017 3:00 pm
by dequi
Bummer, but thanks, I'll see how I can rig this up in an other way then.

Don't want to buy a programmable keyboard like http://xkeys.com/XkeysKeyboards/index.php (those are expensive) when I have multiple laying around. maybe http://www.instructables.com/id/Making- ... -less-tha/ can help. who knows.

Re: [keyboard] - differentiate between different keyboards

Posted: Sun Sep 17, 2017 3:08 pm
by kgschlosser
you always have the multitap plugin.

Re: [keyboard] - differentiate between different keyboards

Posted: Sun Sep 17, 2017 3:28 pm
by kgschlosser
I found something that is already made up to do exactly what you want. I am going to attach a zip. run it and see if it is able to tell what keyboard sent the keystrokes. if it works then I might be able to convert the dll's to pyd's and get them to work inside of python.

Re: [keyboard] - differentiate between different keyboards

Posted: Mon Sep 18, 2017 2:37 pm
by dequi
kgschlosser wrote:run it and see if it is able to tell what keyboard sent the keystrokes.

Yes this works fine on a Windows 7 Pro, 64 bit machine.

Although it needed a restart when adding a new keyboard when it was running, and the source of the one already attached was changed. name stayed the same so that is good.

Re: [keyboard] - differentiate between different keyboards

Posted: Mon Sep 18, 2017 8:27 pm
by kgschlosser
ok so it will work. now the hard part is i have to convert the code to c++ and add it to cFunctions

Re: [keyboard] - differentiate between different keyboards

Posted: Tue Sep 19, 2017 6:48 pm
by dequi
While looking where you got the demo from, reading some of the needed windows api calls and investigating on my own I found a plugin called RawInput in the repository https://github.com/EventGhost/EventGhos ... s/RawInput but it has a noinclude. I think could be the basis or even completely what I'm looking for.
going to test further.

Re: [keyboard] - differentiate between different keyboards

Posted: Tue Sep 19, 2017 7:06 pm
by dequi
Well the RawInput plugin detects the 2 keyboards (don't know what the first one is though) and links KEYDOWN, KEYUP to the correct keyboards.
Apparently not a finished product, but a startpoint. maybe I'll find some time this weekend :roll:

Re: [keyboard] - differentiate between different keyboards

Posted: Tue Sep 19, 2017 7:11 pm
by kgschlosser
well hey if there is a start point to a model that is working then completing a full plugin should not be an issue. I can leverage WMI to grab device captions (device name) we are going to have to make sure it can handle key combinations properly.

Re: [keyboard] - differentiate between different keyboards

Posted: Mon Sep 25, 2017 10:51 am
by topix
Just a thought: would the generic HID plugin work?

Re: [keyboard] - differentiate between different keyboards

Posted: Mon Sep 25, 2017 3:24 pm
by kgschlosser
the issue with the whole keyboard hooking and raw input is the capturing of the keystrokes. if you use the one that can capture the keystrokes you do not get notifications of what keyboard it is taking place on. and the current setup of eg is if the keystrokes is used in a macro then it doesn't get passed on to the program it was intended for.