Code: Select all
-- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');
taran = function (key)
print(key)
local file = io.open("C:\\Users\\TaranVanHemert\\Documents\\test2.txt", "w")
print("we are inside the text file")
file:write(key)
file:flush()
file:close()
lmc_send_keys('{F24}')
end
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
--if (button == string.byte('C')) then lmc_spawn("calc")
if (button == 45) then taran('insert')
elseif (button == 36) then taran('home')
elseif (button == 33) then taran('pageup')
elseif (button == 46) then taran('delete')
elseif (button == 35) then taran('end')
elseif (button == 34) then taran('pagedown')
elseif (button == 27) then taran('escape')
elseif (button == 112) then taran('F1')
elseif (button == 113) then taran('F2')
elseif (button == 114) then taran('F3')
elseif (button == 115) then taran('F4')
elseif (button == 116) then taran('F5')
elseif (button == 117) then taran('F6')
elseif (button == 118) then taran('F7')
elseif (button == 119) then taran('F8')
elseif (button == 120) then taran('F9')
elseif (button == 121) then taran('F10')
elseif (button == 122) then taran('F11')
elseif (button == 123) then taran('F12')
elseif (button == string.byte('Q')) then taran('q')
elseif (button == string.byte('W')) then taran('w')
elseif (button == string.byte('E')) then taran('e')
elseif (button == string.byte('R')) then taran('r')
elseif (button == string.byte('T')) then taran('t')
elseif (button == string.byte('Y')) then taran('y')
--and so on...
else print('Not yet assigned: ' .. button)
end
end)
I am really quite bad at code, and have only barely been able to kludge this together. Still, it seems to work for ALL other keys except the function keys.
Oh, and Prt Scr is also gettting through without being blocked.
I am not sure about Scroll lock and Pause Break. I don't know how to test those...
Bug?
Also, luamacros was letting ALL keystrokes through, yesterday... even with just the sample script. it only resolved itself when I restarted the computer.