尝试将中键单击按钮分配给 LUA 自动点击器脚本(Logitech G203 鼠标)

Trying to assign middle click button to LUA autoclicker script (Logitech G203 Mouse)

我想知道每当我单击鼠标的中间(滚动)按钮时如何打开此自动点击器。当我按下其中一个侧面按钮时,此脚本似乎可以正常工作,但我似乎无法弄清楚如何让它对我的中间按钮起作用。

EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
   --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
   if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then 
      repeat 
         PressAndReleaseMouseButton(1)
         Sleep(math.random(30, 60)) 
      until not IsMouseButtonPressed(4) 
   end
end

罗技鼠标按钮枚举非常重要:-)

EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
   --OutputLogMessage("Event: "..event.." Arg: "..arg.."\n")
   if event == "MOUSE_BUTTON_PRESSED" and arg == 3 then -- 3 = middle
      repeat 
         PressAndReleaseMouseButton(1)
         Sleep(math.random(30, 60)) 
      until not IsMouseButtonPressed(2) -- 2 = middle
   end
end