Sending Keys

How can be this controlled in that simulator? Can HIDmacros be used with this application?
Post Reply
Encursed
Posts: 1
Joined: 17 Mar 2018, 17:23

Sending Keys

Post by Encursed » 17 Mar 2018, 17:27

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!

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Sending Keys

Post by admin » 19 Mar 2018, 10:25

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...
Petr Medek
LUAmacros author

zqckfair
Posts: 3
Joined: 17 Apr 2016, 22:10

Re: Sending Keys

Post by zqckfair » 22 Mar 2020, 23:11

admin wrote:
19 Mar 2018, 10:25
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...
Sorry for making this old thread back to life, but I was wondering how I could make this working because
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)      
And 2)
-K parameter is making luamacros crashing with "parameter error"

Post Reply