(edited this post to clarify & replaced with updated code)
I have surprised myself and figured it out!
For others who might make use of this, my complete script is as follows:
Code: Select all
lmc_print_devices() //List attached keyboards
lmc_device_set_name('streamdeck','54EFE92') //Give the keyboard a friendly name
lmc_set_handler('streamdeck', function(button,direction) //Listen for key presses from named keyboard
if (direction == 1) then return end //ignore button release
if (button == 13) then //if button is enter
lmc_send_keys('^{ENTER}', 50) //send key combo ctrl + enter then pause for 50ms
elseif (button == 97) then
lmc_send_keys('^{NUM1}', 50)
elseif (button == 98) then
lmc_send_keys('^{NUM2}', 50)
elseif (button == 99) then
lmc_send_keys('^{NUM3}', 50)
elseif (button == 100) then
lmc_send_keys('^{NUM4}', 50)
elseif (button == 101) then
lmc_send_keys('^{NUM5}', 50)
elseif (button == 102) then
lmc_send_keys('^{NUM6}', 50)
elseif (button == 103) then
lmc_send_keys('^{NUM7}', 50)
elseif (button == 104) then
lmc_send_keys('^{NUM8}', 50)
elseif (button == 105) then
lmc_send_keys('^{NUM9}', 50)
elseif (button == 111) then
lmc_send_keys('^{NUMDIVIDE}', 50)
elseif (button == 106) then
lmc_send_keys('^{NUMMULTIPLY}', 50)
elseif (button == 109) then
lmc_send_keys('^{NUMMINUS}', 50)
elseif (button == 107) then
lmc_send_keys('^{NUMPLUS}', 50)
elseif (button == 8) then
lmc_send_keys('^{BACKSPACE}', 50)
elseif (button == 110) then
lmc_send_keys('^{NUMDECIMAL}', 50)
elseif (button == 96) then
lmc_send_keys('^{NUM0}', 50)
end
end
)
I found the keyboard ID number (for me 54EFE92) by running lmc_print_devices() and copying the part just before '&0&0000'. It might be helpful to unplug your main keyboard when you run it to identify which is the numpad.
I found the key numbers (i.e. enter is 13, num1 is 97) by running HID macros and observing the numbers in the 'event' field' when you press a key.
This script does all the usable keys on a num pad. To add more keys simply copy & paste one of the 'elseif' statements and replace the key number and key combo to send.