logitech-gaming-software

Script goes into loop


I can't solve the problem, when my script goes into infinite loop, and have no idea how to solve it. I'm using G600 Mouse with LGS, and i want send "9" when mouse button 6 pressed, and send "1" When mouse button 6 released. The mouse button 6 is also assigned to G-Shift function in LGS

what i've try:

function OnEvent(event, arg,family)
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
PressKey("9")
Sleep(100)
end

if event == "MOUSE_BUTTON_RELEASED" and arg == 6 then
PressKey("1")
Sleep(100)
end

Solution

  • You should invoke both pressing and releasing of keys being simulated.
    The most simple way is to use PressAndReleaseKey("9") instead of PressKey("9")

    The mouse button 6 is also assigned to G-Shift function in LGS

    It does not matter.