LuaMacro blocking numpad for normal use
Posted: 19 Apr 2021, 21:13
So I made a macro to remap the function side of the numpad.
That works just fine.
But when I switch to the number side with NUMLOCK, pressing number keys just does nothing:
It won't write numbers, but the script also not works (wich is ofc intended)
So in some way the script blocks the writing of the number and I don't know why.
Here's my script:
--clear consol
clear()
--hide windows to tray
lmc.minimizeToTray = true
--lmc_minimize()
-- assign name to keyboard
lmc_device_set_name('numpad','2DD7D6F1')
--print devices (take out notations if wanted)
lmc_print_devices()
--select keyboard and remap buttons
lmc_set_handler('numpad', function(button,direction)
if (direction == 1) then return end
if (button == 36) then --numpad 7
lmc_send_keys('^+m', 50) --mute/unmute discord
elseif (button == 38) then --numpad 8
lmc_send_keys('^+d', 50) --input/output enable/disable discord
elseif (button == 37) then --numpad 4
lmc_send_keys('%a', 50) --wpe all
elseif (button == 12) then --numpad 5
lmc_send_keys('%s', 50) --wpe save-all
--elseif (button == 39) then --numpad 6
--to be assigned
elseif (button == 35) then --numpad 1
lmc_send_input(177, 0, 0) --previous track
elseif (button == 40) then --numpad 2
lmc_send_input(179, 0, 0) --play / pause
elseif (button == 34) then --numpad 3
lmc_send_input(176, 0, 0) --next track
elseif (button == 107) then --numpad +
lmc_send_input(175, 0, 0) --volume up
--elseif (button == 109) then --numpad -
--to be assigned
end
end
)
That works just fine.
But when I switch to the number side with NUMLOCK, pressing number keys just does nothing:
It won't write numbers, but the script also not works (wich is ofc intended)
So in some way the script blocks the writing of the number and I don't know why.
Here's my script:
--clear consol
clear()
--hide windows to tray
lmc.minimizeToTray = true
--lmc_minimize()
-- assign name to keyboard
lmc_device_set_name('numpad','2DD7D6F1')
--print devices (take out notations if wanted)
lmc_print_devices()
--select keyboard and remap buttons
lmc_set_handler('numpad', function(button,direction)
if (direction == 1) then return end
if (button == 36) then --numpad 7
lmc_send_keys('^+m', 50) --mute/unmute discord
elseif (button == 38) then --numpad 8
lmc_send_keys('^+d', 50) --input/output enable/disable discord
elseif (button == 37) then --numpad 4
lmc_send_keys('%a', 50) --wpe all
elseif (button == 12) then --numpad 5
lmc_send_keys('%s', 50) --wpe save-all
--elseif (button == 39) then --numpad 6
--to be assigned
elseif (button == 35) then --numpad 1
lmc_send_input(177, 0, 0) --previous track
elseif (button == 40) then --numpad 2
lmc_send_input(179, 0, 0) --play / pause
elseif (button == 34) then --numpad 3
lmc_send_input(176, 0, 0) --next track
elseif (button == 107) then --numpad +
lmc_send_input(175, 0, 0) --volume up
--elseif (button == 109) then --numpad -
--to be assigned
end
end
)