Sending keystrokes of second keyboard...

Report any bugs or suspicious behaviour here
Post Reply
echdareez
Posts: 6
Joined: 27 Jan 2020, 13:15

Sending keystrokes of second keyboard...

Post by echdareez » 16 Nov 2022, 23:03

Hi,

Not sure if these fora are still active but here it goes : LUAMacros has worked splendidly for the last 2 years but I noticed some odd behaviour the last couple of months : the second keyboard (fully scripted) also sends the 'intercepted' keys through (first) and does the programmed macro thereafter. So, if I press the "F", it will first type the "F" (tested on Youtube and saw that it goes fullscreen) and do the function for F after this.

This is part of my script (for those interested) - left out the functions :

print(' ')
print('--------------------------------------------------------')
print('Version: ' .. lmc.version)
print('--------------------------------------------------------')
print(' ')

lmc.minimizeToTray = true
lmc_minimize()

--- assign logical name to macro keyboard
lmc_device_set_name('MACROS', 'EE94DD5')
lmc_print_devices()

-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
tt=lmc_get_window_title()

if (direction == 1) then return end -- ignore down
print('Application detected = ' ..tt)
--print('Button pressed = ' .. button)

if (string.match(tt, "Chrome")) then
if (button == string.byte('F')) then lmc_send_keys('^+s') -- un/suspend tab
elseif (button == string.byte('X')) then BookMarkThatTab()
elseif (button == string.byte('W')) then F107()
elseif (button == string.byte('E')) then F109()
elseif (button == string.byte('C')) then lmc_send_keys('^{PGUP}')
elseif (button == string.byte('V')) then lmc_send_keys('^w')
elseif (button == string.byte('B')) then lmc_send_keys('^{PGDN}')
elseif (button == string.byte('T')) then SendToYoutubeDownload()
elseif (button == string.byte('D')) then lmc_send_keys('{LEFT}')
elseif (button == string.byte('G')) then lmc_send_keys('{RIGHT}')
elseif (button == string.byte('Z')) then lmc_send_keys('^+t')
elseif (button == 116) then lmc_send_keys('{F5}') -- F5:Refresh
elseif (button == 32) then lmc_send_keys(' ') -- Space
elseif (button == 16) then lmc_send_keys('^+s') -- Left shift # suspend tab
else print('Not yet assigned: ' .. button)
end
end

end)

Post Reply