please help me

Announcements, general discussion
Post Reply
tuongtndg
Posts: 1
Joined: 01 Dec 2017, 07:01

please help me

Post by tuongtndg » 02 Dec 2017, 04:27

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)
Last edited by tuongtndg on 08 Dec 2017, 03:35, edited 2 times in total.

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

Re: please help me

Post by admin » 04 Dec 2017, 09:27

Of course you can, use the number instead of sitring.byte().
You can see it from the code, button is regular number, there's no magic, just lua basics.
Petr Medek
LUAmacros author

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests