Check key state?
Posted: 02 Mar 2021, 19:20
I'm working on a project to use my second keyboard to do all sorts of cool stuff, for which I'm using LUAMacros for some tasks, and sending all the encoded key event data to a C# programme that does the rest.
I've noticed that although LUAMacros handles the KeyUp and KeyDown events when lmc_set_handler is suitable applied, it can do nothing to hide the state of a held key- for example, if you hold Ctrl on the 2nd (handled) keyboard and press V on the main (unhandled) keyboard, it is seen by the computer as a Ctrl + V combination. In an attempt to subdue this, I had the idea of sending a KeyUp event in my C# programme, which would get immediately handled by the same, thus triggering the virtual key in question to be marked as having been released.
In order to take care of the edge case in which the corresponding key of the main keyboard is simultaneously held (and thus I don't want to send a keyUp event), I was hoping to use LUAMacros to find out if the key is down on the main keyboard. Is there a function for getting the state of a key on a particular keyboard in LUAMacros?
I've noticed that although LUAMacros handles the KeyUp and KeyDown events when lmc_set_handler is suitable applied, it can do nothing to hide the state of a held key- for example, if you hold Ctrl on the 2nd (handled) keyboard and press V on the main (unhandled) keyboard, it is seen by the computer as a Ctrl + V combination. In an attempt to subdue this, I had the idea of sending a KeyUp event in my C# programme, which would get immediately handled by the same, thus triggering the virtual key in question to be marked as having been released.
In order to take care of the edge case in which the corresponding key of the main keyboard is simultaneously held (and thus I don't want to send a keyUp event), I was hoping to use LUAMacros to find out if the key is down on the main keyboard. Is there a function for getting the state of a key on a particular keyboard in LUAMacros?