Sending Keys
Sending Keys
So i am making a keylogger in LMC, and i would like to know if there is an easy way to send the key the user pressed or if you can tell LMC not to intercept the keystrokes. Thanks!
Re: Sending Keys
You have 2 options:
1) use LMC as usual which means once keyboard handler is hooked all original keys are blocked. So you would have to use lmc_send_input or send keys to send original key again
2) recently I have added a parameter to turn the low level keyboard hook (which block original keys) off. My reason was when LMC is used for other purpose than keyboard macros (e.g. game devices only) then there's no need to hook keyboards - this hooking code (for original key blocking) is basically a hack a can cause troubles e.g. with national keyboards with dead keys. So with this parameter the trigerring part is still there (which listen for keys from different keyboards) but the blocking part (which stops original key) is not. Which seems to be exactly what you need for key logger. So may try to run luamacros with parameter -K and see what it does
. I hope I built new exe with this code change already...
1) use LMC as usual which means once keyboard handler is hooked all original keys are blocked. So you would have to use lmc_send_input or send keys to send original key again
2) recently I have added a parameter to turn the low level keyboard hook (which block original keys) off. My reason was when LMC is used for other purpose than keyboard macros (e.g. game devices only) then there's no need to hook keyboards - this hooking code (for original key blocking) is basically a hack a can cause troubles e.g. with national keyboards with dead keys. So with this parameter the trigerring part is still there (which listen for keys from different keyboards) but the blocking part (which stops original key) is not. Which seems to be exactly what you need for key logger. So may try to run luamacros with parameter -K and see what it does

Petr Medek
LUAmacros author
LUAmacros author
Re: Sending Keys
Sorry for making this old thread back to life, but I was wondering how I could make this working becauseadmin wrote: ↑19 Mar 2018, 10:25You have 2 options:
1) use LMC as usual which means once keyboard handler is hooked all original keys are blocked. So you would have to use lmc_send_input or send keys to send original key again
2) recently I have added a parameter to turn the low level keyboard hook (which block original keys) off. My reason was when LMC is used for other purpose than keyboard macros (e.g. game devices only) then there's no need to hook keyboards - this hooking code (for original key blocking) is basically a hack a can cause troubles e.g. with national keyboards with dead keys. So with this parameter the trigerring part is still there (which listen for keys from different keyboards) but the blocking part (which stops original key) is not. Which seems to be exactly what you need for key logger. So may try to run luamacros with parameter -K and see what it does. I hope I built new exe with this code change already...
1) I can't figure out how to "code it" I tried :
Code: Select all
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
if (button == string.byte('C')) then lmc_spawn("calc")
elseif (button == string.byte('N')) then lmc_spawn("notepad", "C:\\test.txt")
elseif (button == string.byte('H')) then lmc_send_keys('Hello world')
else lmc_send_key(button) <<<
end
end)
-K parameter is making luamacros crashing with "parameter error"