罗技脚本:第一次点击、第二次点击、第一次点击、第二次点击事件

Logitech Script: 1st click, 2nd click, 1st click, 2nd click event

我想做的是,如果我按下鼠标上的按钮,它会使用像“E”这样的键,如果我再次按下按钮,它会使用键“W”,再按一次按钮“e” , 又是 "w".
这可能吗?

我找到了这个,但这不是我想要的:

local prev_tm_btn5 = -math.huge

function OnEvent(event, arg, family)

   if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then

      local tm = GetRunningTime()

      local key = tm - prev_tm_btn5 > 2000 and "e" or "w"

      prev_tm_btn5 = tm

      PressKey(key)

      Sleep(15)

      ReleaseKey(key)

   end

end

谢谢!

尝试:

local key

function OnEvent(event, arg, family)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      key = key == "w" and "e" or "w"
      PressKey(key)
      Sleep(15)
      ReleaseKey(key)
   end
end