Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- video explanation is HERE: https://www.youtube.com/watch?v=Arn8ExQ2Gjg
- -- note that some of the code has changed since then (it works better now!)
- -- Though, I have since abandoned luamacros, in favor of Interception... which i will abandon in favor of QMK.
- -- 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 = '3537&PID'
- lmc.minimizeToTray = true
- lmc_minimize()
- --You need to get the identifier code for the keyboard with name "MACROS"
- --This appears about halfway through the SystemID item and looks like 1BB382AF or some other alphanumeric combo.
- -- It's usually 7 or 8 characters long.
- --Once you have this identifier, replace the value of keyboardIdentifier with it
- --Don't ask for keyboard assignment help if the user has manually entered a keyboard identifier
- if keyboardIdentifier == '0000AAA' then
- lmc_assign_keyboard('MACROS');
- else lmc_device_set_name('MACROS', keyboardIdentifier);
- 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()
- --Start Script
- -- define callback for whole device
- lmc_set_handler('MACROS', function(button, direction)
- --Ignoring upstrokes ensures keystrokes are not registered twice, but activates faster than ignoring downstrokes. It also allows press and hold behaviour
- if (direction == 0) then return end -- ignore key upstrokes.
- if (button == 97) then lmc_send_keys('{F13}')
- elseif (button == 98) then lmc_send_keys('{F14}')
- elseif (button == 99) then lmc_send_keys('{F15}')
- elseif (button == 100) then lmc_send_keys('{F16}')
- elseif (button == 101) then lmc_send_keys('{F17}')
- elseif (button == 102) then lmc_send_keys('{F18}')
- elseif (button == 103) then lmc_send_keys('{F19}')
- elseif (button == 104) then lmc_send_keys('{F20}')
- elseif (button == 105) then lmc_send_keys('{F21}')
- elseif (button == 96) then lmc_send_keys('{F22}')
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement