2

Is it possible to make Logitech scripts targets letters?

For example > F

Using mouse button 5 if I wanted this logitech script to press hold F key until release of mouse button 5 how would I do that?

function OnEvent(event, arg)

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

PressAndReleaseMouseButton(5);

end
Egor Skriptunoff
  • 906
  • 1
  • 8
  • 23
damian
  • 23
  • 1
  • 1
  • 5
  • Welcome to SO- please see - How to create a Minimal, Reproducible Example When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is called creating a minimal, reproducible example (reprex), a minimal, complete and verifiable example (mcve), or a minimal, workable example (mwe). - https://stackoverflow.com/help/minimal-reproducible-example – Paul Dawson Jul 31 '19 at 12:53

1 Answers1

3
function OnEvent(event, arg)
   if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
      PressKey("F")
   end
   if event == "MOUSE_BUTTON_RELEASED" and arg == 5 then
      ReleaseKey("F")
   end
end

But you can do the same without writing the script.
Just bind the key F to mouse button 5 by simple drag-and-drop.

Egor Skriptunoff
  • 906
  • 1
  • 8
  • 23
  • The code you provided does press it however in the game I'm using it doesn't repress/let go like the above code is working – damian Jul 31 '19 at 17:39
  • @damian - In your original code replace `PressMouseButton(1);` with `PressKey("G")` and `ReleaseMouseButton(1);` with `ReleaseKey("G")`. – Egor Skriptunoff Jul 31 '19 at 18:48