Simulate keyboard input to active application
Posted: 12 Jul 2017, 22:02
LuaMacros use lmc_send_keys function to simulate key presses to active application. This feature was transferred from HidMacros and uses special format of input string. The format is described at HidMacros help file or at LuaMacros wiki. However this function have limitations (unicode chars), bugs (who said that?
) and uses obsolete windows function to simulate keyboard input.
So from LuaMacros version 0.1.1.9 released on July 12th 2017 there's new function lmc_send_input which is very flexible. It is answer to many requirements like unicode support, sending just key press (and release later) and so on. In fact this is just wrapper around windows function SendInput. It takes 3 numeric parameters
Simple scripts that waits 2 seconds and then sends ABc to active application is

So from LuaMacros version 0.1.1.9 released on July 12th 2017 there's new function lmc_send_input which is very flexible. It is answer to many requirements like unicode support, sending just key press (and release later) and so on. In fact this is just wrapper around windows function SendInput. It takes 3 numeric parameters
- virtual key code
- scan code
- flags
Simple scripts that waits 2 seconds and then sends ABc to active application is
Code: Select all
lmc_sleep(2000)
lmc_send_input(16, 0, 0) -- press shift
lmc_send_input(65, 0, 0) -- press A
lmc_send_input(65, 0, 2) -- release A
lmc_send_input(66, 0, 0) -- press B
lmc_send_input(66, 0, 2) -- release B
lmc_send_input(16, 0, 2) -- release shift
lmc_send_input(67, 0, 0) -- press C
lmc_send_input(67, 0, 2) -- release C