'How do I bind scroll left in Lua in G hub?

I have a Logitech G502 Hero. I want to bind my scroll left ,G11, to an auto clicker. I managed to do it by binding it to middle click and in Lua using IsMouseButtonPressed(2), however that removes the functionality of my middle click. Is there any way around this?

Mouse binds:

1

Code:

function OnEvent(event, arg)
Sleep(50)
while(IsMouseButtonPressed(2)) do
PressAndReleaseMouseButton(1)
PressAndReleaseMouseButton(1)
PressAndReleaseMouseButton(1)
PressAndReleaseMouseButton(1)
Sleep(40)
end
end


Solution 1:[1]

  1. Bind scroll left (G11) to the command "Back".
    This will remove the functionality of your "Back" G4 button, but Middle Click will work.
  2. Set the script:
function OnEvent(event, arg)
  if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    repeat
      PressAndReleaseMouseButton(1)
      PressAndReleaseMouseButton(1)
      PressAndReleaseMouseButton(1)
      PressAndReleaseMouseButton(1)
      Sleep(40)
    until not IsMouseButtonPressed(4)  -- 4 = Back
  end
end

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Egor Skriptunoff