Skip to content

Instantly share code, notes, and snippets.

@MartinHarding
Last active October 28, 2023 10:35
Show Gist options
  • Save MartinHarding/3155be5e286e3f483223a1e21024c554 to your computer and use it in GitHub Desktop.
Save MartinHarding/3155be5e286e3f483223a1e21024c554 to your computer and use it in GitHub Desktop.
Logitech Gaming Software Mouse Button Toggle script
-- Toggles a mouse button when you press another mouse button.
-- 1. Change your mouse to "Automatic Game Detection" mode
-- 2. Right click on a profile's icon and choose scripting
-- 3. Paste this into the default profile script box, save, enjoy!
toggle_button = 7 -- What mouse button should control the toggle
button_to_toggle = 1 -- What button to toggle
button_toggled = false
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == toggle_button then
button_toggled = not button_toggled
OutputLogMessage("Mouse %d toggled %s", button_to_toggle, tostring(button_toggled))
if button_toggled then
PressMouseButton(button_to_toggle)
else
ReleaseMouseButton(button_to_toggle)
end
end
end
@johnwang16
Copy link

No, not with logitech scripting. https://douile.github.io/logitech-toggle-keys/APIDocs.pdf
AutoHotkey is what you want to use

@Parzehlli
Copy link

I figured it OUT! AutoHotKey can get you banned tho in some games? Here- for any future people who come across this your welcome! This is working in the LGS Software with a Logitech G502 or G502 Hero. Hmu for more details on what it does, thanks @johnwang16
"function OnEvent(event, arg)
if IsKeyLockOn ("capslock") then
if event == "MOUSE_BUTTON_PRESSED" and arg == 8 then
PressKey("B")
end
if event == "MOUSE_BUTTON_RELEASED" and arg == 2 then
ReleaseKey("B")
end
elseif IsMouseButtonPressed(3)then
repeat
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(0,1)
Sleep(8)
until not IsMouseButtonPressed(1)
end
until not IsMouseButtonPressed(3)
end
end"

@evanricard
Copy link

Is there any way to apply this profile to a Logitech Ergo MX?

Copy link

ghost commented Jun 7, 2021

https://github.com/RavenBHK/DBD-Left-Hold-and-Auto-Run

I used to above macro and am trying to combine with this one. Can anyone help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment