Advertisement
Guest User

Untitled

a guest
Apr 9th, 2025
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. -- video explanation is HERE: https://www.youtube.com/watch?v=Arn8ExQ2Gjg
  2. -- note that some of the code has changed since then (it works better now!)
  3. -- Though, I have since abandoned luamacros, in favor of Interception... which i will abandon in favor of QMK.
  4. -- get luamacros HERE: http://www.hidmacros.eu/forum/viewtopic.php?f=10&t=241#p794
  5. -- plug in your 2nd keyboard, load this script into LUAmacros, and press the triangle PLAY button.
  6. -- Then, press any key on that keyboard to assign logical name ('MACROS') to macro keyboard
  7. clear() --clear the console from last run
  8. local keyboardIdentifier = '3537&PID'
  9. lmc.minimizeToTray = true
  10. lmc_minimize()
  11.  
  12.  
  13. --You need to get the identifier code for the keyboard with name "MACROS"
  14. --This appears about halfway through the SystemID item and looks like 1BB382AF or some other alphanumeric combo.
  15. -- It's usually 7 or 8 characters long.
  16. --Once you have this identifier, replace the value of keyboardIdentifier with it
  17.  
  18. --Don't ask for keyboard assignment help if the user has manually entered a keyboard identifier
  19. if keyboardIdentifier == '0000AAA' then
  20. lmc_assign_keyboard('MACROS');
  21. else lmc_device_set_name('MACROS', keyboardIdentifier);
  22. end
  23. --This lists connected keyboards
  24. dev = lmc_get_devices()
  25. for key,value in pairs(dev) do
  26. print(key..':')
  27. for key2,value2 in pairs(value) do print(' '..key2..' = '..value2) end
  28. end
  29. print('You need to get the identifier code for the keyboard with name "MACROS"')
  30. print('Then replace the first 0000AAA value in the code with it. This will prevent having to manually identify keyboard every time.')
  31. -- Hide window to tray to keep taskbar tidy
  32. lmc.minimizeToTray = true
  33. --lmc_minimize()
  34.  
  35. --Start Script
  36. -- define callback for whole device
  37. lmc_set_handler('MACROS', function(button, direction)
  38. --Ignoring upstrokes ensures keystrokes are not registered twice, but activates faster than ignoring downstrokes. It also allows press and hold behaviour
  39. if (direction == 0) then return end -- ignore key upstrokes.
  40. if (button == 97) then lmc_send_keys('{F13}')
  41. elseif (button == 98) then lmc_send_keys('{F14}')
  42. elseif (button == 99) then lmc_send_keys('{F15}')
  43. elseif (button == 100) then lmc_send_keys('{F16}')
  44. elseif (button == 101) then lmc_send_keys('{F17}')
  45. elseif (button == 102) then lmc_send_keys('{F18}')
  46. elseif (button == 103) then lmc_send_keys('{F19}')
  47. elseif (button == 104) then lmc_send_keys('{F20}')
  48. elseif (button == 105) then lmc_send_keys('{F21}')
  49. elseif (button == 96) then lmc_send_keys('{F22}')
  50. end
  51. end)
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement