Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This is a combo of several scripts and a bit of my own work to make a simple
- -- budget Streamdeck. Pressing a key on the numpad will instead type a set of keys
- -- designed to be set as a shortcut in a program like OBS or Streamlabs.
- -- Just take the key on the numpad, but add "ctrl+alt" to it to make the shortcut
- -- in your program of choice. IE: pressing 'Enter' on the numpad will send the key
- -- combo 'ctrl+alt+numpad enter' to the system.
- -- Credit to Taran Van Hemert for the code at the top that pulls the keyboards
- -- unique identifiers.
- -- Enjoy!
- -- 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 ('budgetDeck') to macro keyboard
- clear() -- clear the console from any previous runs
- lmc.minimizeToTray = true -- Minimizes LuaMacros to the tray to make things tidy
- local keyboardIdentifier = '0000AAA0' -- CHANGE THIS ONCE YOU KNOW THE RIGHT ONE!!
- -- You need to get the identifier code for the keyboard with name "budgetDeck"
- -- 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 == '0000AAA0' then
- lmc_assign_keyboard('budgetDeck');
- else lmc_device_set_name('budgetDeck', 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 "budgetDeck"')
- print('Then replace the first 0000AAA value in the code with it. This will prevent having to manually identify keyboard every time.')
- -- This is the code that intercepts the keypress, and sends the new key combo.
- lmc_set_handler('budgetDeck', function(button,direction)
- if (direction == 1) then return end
- if (button == 96) then
- lmc_send_keys('%^{NUM0}', 50)
- clear()
- print('You Pressed: 0 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 97) then
- lmc_send_keys('%^{NUM1}', 50)
- clear()
- print('You Pressed: 1 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 98) then
- lmc_send_keys('%^{NUM2}', 50)
- clear()
- print('You Pressed: 2 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 99) then
- lmc_send_keys('%^{NUM3}', 50)
- clear()
- print('You Pressed: 3 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 100) then
- lmc_send_keys('%^{NUM4}', 50)
- clear()
- print('You Pressed: 4 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 101) then
- lmc_send_keys('%^{NUM5}', 50)
- clear()
- print('You Pressed: 5 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 102) then
- lmc_send_keys('%^{NUM6}', 50)
- clear()
- print('You Pressed: 6 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 103) then
- lmc_send_keys('%^{NUM7}', 50)
- clear()
- print('You Pressed: 7 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 104) then
- lmc_send_keys('%^{NUM8}', 50)
- clear()
- print('You Pressed: 8 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 105) then
- lmc_send_keys('%^{NUM9}', 50)
- clear()
- print('You Pressed: 9 ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 111) then
- lmc_send_keys('%^{NUMDIVIDE}', 50)
- clear()
- print('You Pressed: / ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 106) then
- lmc_send_keys('%^{NUMMULTIPLY}', 50)
- clear()
- print('You Pressed: * ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 109) then
- lmc_send_keys('%^{NUMMINUS}', 50)
- clear()
- print('You Pressed: - ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 107) then
- lmc_send_keys('%^{NUMPLUS}', 50)
- clear()
- print('You Pressed: + ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- elseif (button == 110) then
- lmc_send_keys('%^{NUMDECIMAL}', 50)
- clear()
- print('You Pressed: . ~ Which Is Button #' .. button .. ' ~ Sent: Ctrl+Alt+1')
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement