It seems to search for an already printed string and autocomplete to that and send that instead
What I suspected that it would do:
Not to autocomplete and send the string I have given with just the character 'h' with an enter
`-- get luamacros HERE: http://www.hidmacros.eu/forum/viewtopic.php?f=10&t=241#p794
-- plug in your 2nd keyboard, load this script into LUAmacros, and press the triangle PLAY button.
-- Then, press any key on that keyboard to assign logical name ('MACROS') to macro keyboard
clear() --clear the console from last run
local keyboardIdentifier = '2A1CBAB5'
BarCodeScanner1 = ''
print(BarCodeScanner1)
if keyboardIdentifier == '0000AAA' then --if this key is pressed by a known scanner
lmc_assign_keyboard('MACROS'); --just do the input
else lmc_device_set_name('MACROS', keyboardIdentifier); --execute scanner code
end
--This lists connected keyboards
dev = lmc_get_devices()
for key,value in pairs(dev) do
print(key..':')
for key2,value2 in pairs(value) do print(' '..key2..' = '..value2) end
end
print('You need to get the identifier code for the keyboard with name "MACROS"')
print('Then replace the first 0000AAA value in the code with it. This will prevent having to manually identify keyboard every time.')
-- Hide window to tray to keep taskbar tidy
lmc.minimizeToTray = true
--lmc_minimize()
function wait(seconds)
local _start = os.time()
local _end = _start+seconds
while (_end ~= os.time()) do
end
end
-- define callback for whole device
lmc_set_handler('MACROS', function(button, direction)
if (direction == 0) then return end -- ignore key upstrokes.
if type(config[button]) == "string" then
--print(' ')
--print('Your key ID number is: ' .. button)
--print('It was assigned string: ' .. config[button])
if button == 13 then
BarCodeScanner1 = '' .. BarCodeScanner1 .. '~'
print('data: ' .. BarCodeScanner1)
lmc_send_keys(BarCodeScanner1)
BarCodeScanner1 = ''
else
BarCodeScanner1 = BarCodeScanner1 .. config[button]
end
else
print(' ')
print('Not yet assigned: ' .. button)
end
There seems to be an enter issue, and I managed to track it down and make it consistent. Code is below.
Input given to keyboard
Feedback from program:
What the program does:
It seems to search for an already printed string and autocomplete to that and send that instead
What I suspected that it would do: Not to autocomplete and send the string I have given with just the character 'h' with an enter
`-- get luamacros HERE: http://www.hidmacros.eu/forum/viewtopic.php?f=10&t=241#p794 -- plug in your 2nd keyboard, load this script into LUAmacros, and press the triangle PLAY button. -- Then, press any key on that keyboard to assign logical name ('MACROS') to macro keyboard clear() --clear the console from last run
local keyboardIdentifier = '2A1CBAB5'
BarCodeScanner1 = ''
print(BarCodeScanner1)
if keyboardIdentifier == '0000AAA' then --if this key is pressed by a known scanner lmc_assign_keyboard('MACROS'); --just do the input else lmc_device_set_name('MACROS', keyboardIdentifier); --execute scanner code end --This lists connected keyboards dev = lmc_get_devices() for key,value in pairs(dev) do print(key..':') for key2,value2 in pairs(value) do print(' '..key2..' = '..value2) end end
print('You need to get the identifier code for the keyboard with name "MACROS"') print('Then replace the first 0000AAA value in the code with it. This will prevent having to manually identify keyboard every time.') -- Hide window to tray to keep taskbar tidy
lmc.minimizeToTray = true --lmc_minimize()
local config = {
}
function wait(seconds) local _start = os.time() local _end = _start+seconds while (_end ~= os.time()) do end end
-- define callback for whole device lmc_set_handler('MACROS', function(button, direction) if (direction == 0) then return end -- ignore key upstrokes. if type(config[button]) == "string" then --print(' ') --print('Your key ID number is: ' .. button) --print('It was assigned string: ' .. config[button])
end) `