Advertisement
lunamoonraker

AUTO-RUN SCRIPT FOR A LOGITECH MOUSE

Jun 14th, 2015
2,811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. *AUTO-RUN SCRIPT INSTRUCTIONS FOR A LOGITECH MOUSE*
  2. Logitech Gaming Software script for a simple 'Auto-run' toggle feature using a LGS supported Logitech mouse. Useful for games which do not have the feature (i.e. Witcher 3 currently)
  3.  
  4. This method requires little technical knowledge as you simply copy/ paste the provided code.
  5.  
  6. * HOW TO CREATE THE SCRIPT*
  7. In this EXAMPLE the Logitech G700s 'G5' button is set to toggle ON/OFF the 'N' keyboard key. To create the script;
  8.  
  9. 1) Launch the Logitech Gaming Software application (if not installed download from the main Logitech site for your mouse model) and ensure 'Automatic Game Detection' is enabled on the Home window (right side toggle switch)
  10.  
  11. 2) Open the 'Profiles' window (mouse with two arrows on bottom right menu) and select the relevant game profile icon (top right) so it is highlighted.
  12.  
  13. 3) Right-click the game profile icon and select 'Scripting'.
  14.  
  15. 4) Copy/ Paste the following lua script into the Script window (copy only the code not any spaces above/ below);
  16.  
  17. function OnEvent(event, arg, family)
  18. if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
  19. G5_Toggle = not G5_Toggle
  20. if G5_Toggle then
  21. PressKey("n")
  22. else
  23. ReleaseKey("n")
  24. end
  25. end
  26. end
  27.  
  28. 5) Click 'Script' on the window menu bar and 'Save' then close the window.
  29.  
  30. Done! Now to test it and set which button/ key you prefer.
  31.  
  32. *TEST THE SCRIPT*
  33. To test that it is functioning correctly;
  34.  
  35. 6) Right-click the game profile icon and select 'Test Profile' to open up it's window
  36.  
  37. 7)Press the G-Button you have chosen and you should see just a Down press registered. Press it again and you should see the Up press (the 'sec delay' is just showing the delay in the button presses and not important)
  38.  
  39. 8) Once it is confirmed to be working correctly, Click 'OK' to close the test window.
  40.  
  41. If it doesn't work in-game check you have the latest version of LGS. If so delete and reinstall it. Double check for any empty lines or spaces in the copied code.
  42.  
  43. *NOTE*: This works currently but code or features can and do change. You can only have one script at a time in LGS.
  44.  
  45. * HOW TO SET THE DESIRED G-BUTTON & KEYBOARD KEY*
  46. To chose which G-Button on use, just change the numerical value on line 2, where for G5 it is 'arg == 5'. Replace the '5' with whichever G-Button number you want to use.
  47.  
  48. To change which keyboard key it toggles change the letter on line 5, where in this example 'PressKey("n")'. Replace the 'n' with whichever key you want to use.
  49.  
  50. Repeat this for line 7 for 'ReleaseKey("n")'. Replace the 'n' with whichever key you want to use.
  51.  
  52. *SUMMARY*
  53. This works for me on my Logitech G700s mouse and enables the use of auto-run type toggling in Witcher 3 which doesn't have the option currently.
  54.  
  55. Hopefully this will also work for other supported Logitech mice using the LGS.
  56.  
  57. I have no lua scripting knowledge and there maybe more elegant ways to achieve the same function. I used an example from a forum post and altered it for my purposes. Thanks to the original poster 'TheRealBusters'. The original posted code can be found here;
  58.  
  59. https://forums.logitech.com/t5/Logitech-G-Mice/Scripting-for-a-G600-Toggling-shift-key/td-p/1283748
  60.  
  61. Hope this saves time & frustrations for others looking for a simple way to enable this on a Logitech mouse. Enjoy the reduced strain on the fingers & enjoy the surroundings!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement