lua 罗技 g512 键盘的脚本问题

lua script problem for logitech g512 keyboard

我想在我的 logitech g512 键盘中实现这个 lua 脚本,该脚本由“Egor Skriptunoff”在我的前一个线程中发布。

问题是我尝试了一些像这样的修改,即将 (MOUSE_BUTTON_PRESSED) 替换为 (G_PRESSED),因为我的键盘有 f1-f12 g 键,但没有任何效果。有什么解决办法吗?

local keys = {"5", "6", "7"}   -- cycle of keys
local idx = 0
local tm = -math.huge

function OnEvent(event, arg, kb)
if event == "G_PRESSED" and arg == 2 then
      if GetRunningTime() - tm > 1000 then
         idx = 0
      end
      idx = idx % #keys + 1
      PressKey(keys[idx])
   elseif event == "G_RELEASED" and arg == 2 then
      ReleaseKey(keys[idx])
      tm = GetRunningTime()
   end
end

脚本没问题
问题在于 GHUB - 它不会生成 G 键事件,直到您将非标准宏绑定到它。
所以,创建一个宏“Press F2 - wait 50 ms - Release F2”并将其分配给GHUB中的G2(以保存按键的原始功能)。不要绑定标准的“F2”宏!
之后你的脚本就可以工作了。