Help with Syntax please.

Announcements, questions
Post Reply
doctornikesh
Posts: 3
Joined: 29 Jun 2015, 21:50

Help with Syntax please.

Post by doctornikesh » 18 Aug 2015, 03:23

Yet another newbie question, below is the sample script, the aplhanumeric keys like "C" and 'E 'works but I want use keys like HOME,NUM1,F1 key,NUMMINUS. Please help me with the syntax to use Number pad keys or special keys like capslock in the last line of this sample code. Is there any reference somewhere in hidmacros or in Lua.org
Can I use the the Keynumber generated from the error message of "Not yet assigned: 32" ?

- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');

-- define callback for whole device
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('E')) then lmc_spawn("wscript", "C:\\Users\\npatel\\Desktop\\Email.vbs")
elseif (button == string.byte('NUMMINUS')) then lmc_spawn("wscript", "C:\\Users\\npatel\\Desktop\\webstation.vbs")

else print('Not yet assigned: ' .. button)
end
end)

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

Re: Help with Syntax please.

Post by admin » 18 Aug 2015, 08:10

Without any testing or having closer look...
If your message says "Not yet assigned: 32", why don't you add condition:

Code: Select all

...
elseif (button == 32) then ...
Petr Medek
LUAmacros author

Post Reply