Logitech Lua detect double click or hold

135 Views Asked by At

I'm attempting to make a Lua script with Logitechs API that will detect when I hold the dpi shift button on my mouse and then simulate a keypress.

However, I cant find the right function to tell if that button is pressed or not. Any ideas or recommendations to improve this program would be nice.

Here is my first attempt at a hold program:

function OnEvent(G_PRESSED, G5)
  Sleep(500)
  if IsMouseButtonPressed(5) then
    MoveMouseTo(0,0)
  end
  
end
1

There are 1 best solutions below

0
On

"DPI shift" action can be assigned to any physical mouse button.
So, I don't know which button you are talking about.

Assuming you want to simulate key "A" press when mouse button 5 ("Forward") is pressed:

function OnEvent(event, arg)
  if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
    PressAndReleaseKey("A")
  end
end