Page 1 of 1

lmc_get_button

Posted: 17 Dec 2018, 11:03
by metrolive
Hi,

Thanks for creating such a small but useful program. I have change to a notebook computer recently, and am trying create some hotkey within the small keyboard.I am trying to create some kind of combo keys:

{f2}+{f3} open website A
{f2}+{f4} open web site B
{f2} press f2
{f3} press f3
{f4} press f4

Two approach I was trying:
1.
  • create a variable 'isF2'=0.
  • when f2 is press, 'isF2'=1
  • when f3 is press check 'isF2'
However the F3 handler cannot get 'isF2' =1 even when F2 is pressed

2.use lmc_get_button
  • i input the parameter like this:

Code: Select all

print(' isF2: ' .. lmc_get_button('MACROS',113)) 
However, it says: [DX] ERROR: Device MACROS is not game device. Axis are supposed to be handled for game devices only.
It seem the axis function is the previous function in the code.

Am I using the right function to create my script?

I don't want to use typical ctrl/shift/alt + key ,as there are always some program assigning that hot key.
there are fn key on the notebook, but as I test luamacro cannot detect keypress of it.
Thanks

Re: lmc_get_button

Posted: 18 Dec 2018, 09:22
by admin
ad 1) this should work, just make sure you define isF2 in global scope (not inside f2 handler only). I'm using such 'global' variables in my scripts, you can check lmc.lua in source repo
ad 2) as the message says - lmc_get_button is only for game devices (joystick) buttons, not for keyboards