Disable original key echo

Announcements, questions
michal.postrozny
Posts: 1
Joined: 25 Aug 2015, 09:25

Disable original key echo

Post by michal.postrozny » 25 Aug 2015, 10:17

Hi,

Great app! I also like the idea of moving to scripting language and getting rid of GUI - cleaner and more powerful. But to the question:

Using the code below when pressing 'a' on 'KBD2' keyboard I get 'axyz' while I would like to get 'xyz' only. How can I get rid of the "original" key character inserted before the LuaMacros defined characters?

Code: Select all

lmc_device_set_name('KBD2', '33B83F9D')
lmc_print_devices()

lmc_set_handler('KBD2',function(button, direction)
  print('Callback for whole keyboard 2: button ' .. button .. ', direction '..direction)

  if (direction == 0) then
    if (button == string.byte('A')) then
    print('a pressed')
    lmc_send_keys('xyz')
    end
  end
end)
Here's console output:

Code: Select all

KBD2  :  \\?\HID#VID_413C&PID_2003#7&33B83F9D&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD} [877594791] :  keyboard
<unassigned>  :  \\?\HID#VID_413C&PID_2107#8&EB4CC40&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD} [1624639279] :  keyboard
Total number of devices: 2
Callback for whole keyboard 2: button 65, direction 1
Callback for whole keyboard 2: button 65, direction 0
a pressed
Thanks!
Michal,

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

Re: Disable original key echo

Post by admin » 26 Aug 2015, 07:40

Thanks.
It should be disabled, what's your testing appilcation (the one in foreground that receives 'a' as well)? Is the behaviour the same in different applications (notepad)?
What's your OS?
Petr Medek
LUAmacros author

timmee2222
Posts: 5
Joined: 28 Aug 2015, 00:27

Re: Disable original key echo

Post by timmee2222 » 28 Aug 2015, 09:34

Hi
I'm getting the same result

Code: Select all

clear();
lmc_device_set_name('keyPad', '123F1D63')
lmc.minimizeToTray = true

lmc_set_handler('keyPad',function(button, direction)
 if (direction == 1) then return end  -- ignore down
  print('Callback for whole keyboard 2: button ' .. button .. ', direction '..direction)
     if     (button == 111) then lmc_send_keys('It rocks!')  end
end) 
I'm in win 10
testing with notepad++

also the

Code: Select all

lmc.minimizeToTray = true
puts a icon in the task area but dosn't actually minimize the applicatioin

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

Re: Disable original key echo

Post by admin » 31 Aug 2015, 08:06

lmc.minimizeToTray is the flag telling "If LuaMacros is minimized, hide it from task panel and show only tray icon". It's a property. It's not executive thing that would minmize application itself.
To minimize the app, call lmc_minimize() - see this post: http://www.hidmacros.eu/forum/viewtopic ... t=241#p807

Regarding echoed key - I'll try myself later, stay tuned
Petr Medek
LUAmacros author

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

Re: Disable original key echo

Post by admin » 01 Sep 2015, 20:53

michal.postrozny wrote:Using the code below when pressing 'a' on 'KBD2' keyboard I get 'axyz' while I would like to get 'xyz' only.
I just tested and works fine at my Win7 64bit. I got xyz only.

Maybe Windows 10 specific..?
Petr Medek
LUAmacros author

lexazan
Posts: 1
Joined: 08 Nov 2015, 00:49

Re: Disable original key echo

Post by lexazan » 08 Nov 2015, 00:55

Same echo problem here with USB numpad on Windows 8.1 x64

Code: Select all

lmc_device_set_name('NUMPAD', '1498AC1B')

lmc_set_handler('NUMPAD',function(button, direction)
  if (direction == 1) then return end  -- ignore down
  if     (button == 8) then lmc_send_keys('`') -- Select whistle
  elseif (button == 103) then lmc_send_keys('u') --All stop
  elseif (button == string.byte('H')) then lmc_send_keys('Hello world')
  else print('Not yet assigned: ' .. button) 
  end
end)  
Tried running as admin with out luck. Any suggestions?

UPDATE: Just tested HID Macros, no problems there :|

User avatar
Scratch
Posts: 6
Joined: 06 Nov 2015, 13:59

Re: Disable original key echo

Post by Scratch » 08 Nov 2015, 09:47

I started having this problem to today

Image

It didn't used to be a problem though, strangely enough

Here's my code

Code: Select all

print 'prog start'
-- assign logical name to macro keyboard
--lmc_assign_keyboard('KBoard');

lmc.minimizeToTray = true
--lmc_minimize()


lmc_device_set_name('kp', '1C354B37')
lmc_device_set_name('ducky', '88622F7')
lmc_device_set_name('naga', '69D38C2')

nagaRow = true
-- define callback for whole device
lmc_set_handler('kp',function(button, direction)
  if (direction == 1) then return end  -- ignore down
  if (button == 109) then lmc_send_keys('{F24}')--lmc_spawn("cmd") --NUM MINUS
 -- elseif (button == 97) then lmc_send_keys('¯\\_+9{NUMPLUS}{NUM3}{NUM0}C{NUM4}+0_/¯')
  elseif (button == 106) then lmc_send_keys('%{F24}') --ASTERICKS
  elseif (button == 13) then   --KP ENTER
         if (nagaRow) then nagaRow = false
         else nagaRow = true
         end
  elseif (button == 96) then lmc_send_keys('+{F10}')
  else print('KP Not yet assigned: ' .. button)
  end
end)

lmc_set_handler('naga',function(button, direction)
  if (direction == 0) then return end  -- ignore
  if (nagaRow) then
        if(button == 49) then lmc_send_keys('1')
        elseif(button == 50) then lmc_send_keys('2')
        elseif(button == 51) then lmc_send_keys('3')
        elseif(button == 52) then lmc_send_keys('4')
        elseif(button == 53) then lmc_send_keys('5')
        elseif(button == 54) then lmc_send_keys('6')
        elseif(button == 55) then lmc_send_keys('7')
        elseif(button == 56) then lmc_send_keys('8')
        elseif(button == 57) then lmc_send_keys('9')
        elseif(button == 48) then lmc_send_keys('0')
        elseif(button == 189) then lmc_send_keys('-')
        elseif(button == 187) then lmc_send_keys('=')
        end
  else
        if(button == 49) then lmc_send_keys('{NUM1}')
        elseif(button == 50) then lmc_send_keys('{NUM2}')
        elseif(button == 51) then lmc_send_keys('{NUM3}')
        elseif(button == 52) then lmc_send_keys('{NUM4}')
        elseif(button == 53) then lmc_send_keys('{NUM5}')
        elseif(button == 54) then lmc_send_keys('{NUM6}')
        elseif(button == 55) then lmc_send_keys('{NUM7}')
        elseif(button == 56) then lmc_send_keys('{NUM8}')
        elseif(button == 57) then lmc_send_keys('{NUM9}')
        elseif(button == 48) then lmc_send_keys('{NUM0}')
        elseif(button == 189) then lmc_send_keys('{NUMMINUS}')
        elseif(button == 187) then lmc_send_keys('{NUMPLUS}')
  end
end
end)



--elseif (button == string.byte('N')) then lmc_spawn("notepad", "C:\\test.txt")
  --elseif (button == string.byte('H')) then lmc_send_keys('Hello world')

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

Re: Disable original key echo

Post by admin » 09 Nov 2015, 09:26

Lexazan: I'll try your script, what's your active application? Can it be notepad?
Scratch: Can hardly recognize what's you actual problem. What are the keys you're pressing and what's expected behaviour?
Petr Medek
LUAmacros author

User avatar
Scratch
Posts: 6
Joined: 06 Nov 2015, 13:59

Re: Disable original key echo

Post by Scratch » 12 Nov 2015, 04:54

Pressing asterisks on the keypad sends alt-F24, a bind I use for the Nvidia overlay, as shown slightly in the gif.
However it's also sending an asterisks key, as displayed in the text box, this is not intended behaviour.

I'm unsure, but I believe that this may be because the program no longer disables keys if the input is disconnect on some reasons.

My keypad is plugged into my computer monitor, which acts as a bridge. If I turn the monitor off, they keypad is disconnected too.

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

Re: Disable original key echo

Post by admin » 21 Nov 2015, 00:35

Still cannot reproduce this one, my keys with callback are not echoed.
However please check the latest build (download link still the same) version 0.1.0.233 which has low level keyboard code reworked because of some different bug.
If you still get the echo I will prepare special version of the dll library which should always block the key. Then we'll see if blocking itself has problem or the logic in LMC.
Petr Medek
LUAmacros author

Post Reply