Skip to content

Instantly share code, notes, and snippets.

@Lain818
Created August 30, 2019 19:40
Show Gist options
  • Save Lain818/2782e961ff506f347d5730dc7178b851 to your computer and use it in GitHub Desktop.
Save Lain818/2782e961ff506f347d5730dc7178b851 to your computer and use it in GitHub Desktop.
Basic LuaMacros Setup
clear() --clear the console from last run
local keyboardIdentifier = '13DD145D'
lmc_print_devices()
if keyboardIdentifier == '0000AAA' then
lmc_assign_keyboard('MACROS');
else lmc_device_set_name('MACROS', keyboardIdentifier);
end
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.')
lmc.minimizeToTray = true
lmc_minimize()
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
if (button == 74) then lmc_spawn("calc")
else print('Not yet assigned: ' .. button)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment