Controling Logitech LEDs with AHK

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Scr1pter
Posts: 1271
Joined: 06 Aug 2017, 08:21
Location: Germany

Controling Logitech LEDs with AHK

Post by Scr1pter » 19 May 2022, 18:43

Hey all,

Long time no see - hope you're all fine.

I got a new mouse (Logitech G502 LS) and needed to install GHub and uninstall the Logitech Gaming Software.
Unfortunately I can't control the LEDs with AHK anymore.
It didn't work, then it worked and now it does not work again - and I have no clue why.

When I turn in the "LED control by AHK" inside of the GHub, both my mouse and my keyboard show no light anymore.

This is my LED script in AHK:

Code: Select all

LGS_Farbe_Initialisieren()

F1::
LGS_Farbe_Festlegen(100, 0, 100)
return


LGS_Farbe_Initialisieren()
{
  hModule := DllCall("LoadLibrary", "Str", "C:\Users\USER\Documents\Logitech Gaming Software\AutoHotKey-Scripts\LogitechLedEnginesWrapper.dll", "Ptr")
  if hModule = 0
  {
    MsgBox, LogitechLedEnginesWrapper.dll konnte nicht gefunden werden!
  }
  DllCall("LogitechLedEnginesWrapper\LogiLedInit")  
}
LGS_Farbe_Festlegen(rot, grün, blau)
{
  DllCall("LogitechLedEnginesWrapper\LogiLedSetLighting", "Int", rot, "Int", grün, "Int", blau)
}
It used to work perfectly with Logitech Gaming Software, and I didn't change it, so it must be something with the GHub.

Does anybody know what the problem could be?

For me it's important to change the LED, because it's an optical feedback which mode I am (I toggle buttons and keys).
ahkLGhubLED.png
ahkLGhubLED.png (17.86 KiB) Viewed 1705 times
Thanks for any help and best regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

User avatar
Scr1pter
Posts: 1271
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Controling Logitech LEDs with AHK

Post by Scr1pter » 21 May 2022, 09:28

Hello again,

I reinstalled GHub and now it works, but let's see if it will stop working again...

Thanks anyway.
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

TrebleTA
Posts: 134
Joined: 20 Nov 2021, 06:44

Re: Controling Logitech LEDs with AHK

Post by TrebleTA » 24 May 2022, 18:47

Ghub always gives me problem too. Like no afftects after a restart so have to go in ghub and select desktop. Among others.
Try OpenRGB.

User avatar
Scr1pter
Posts: 1271
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Controling Logitech LEDs with AHK

Post by Scr1pter » 29 May 2022, 19:25

Thanks for your suggestion.

Well, I have another idea:
I usually only use 1 permanent profile (doesn't matter if LGS or GHub) and I use an AHK script to adjust the function (depending on the currently active app).
So I use LGS or GHub just to assign F13 till F19 for my additional mouse buttons - using a lua script.

However, I realized I could just drag them as normal key assigments using the software and then store everything as an internal slot.
ahk_ghub.png
ahk_ghub.png (269.62 KiB) Viewed 1545 times
There are some DPI issues, though, (after mouse was 15 min inactive), but I think it just picks the lowest setted dpi.
I use 4500, so I set 4500 as #1, 8000 as #2 and 10000 as #3 (I only need 4500).
So it means whatever happens, it should always activate 4500 dpi and all the F13 till F19 keys work as well.

I guess now I could just uninstall GHub again and install the LGS (even though it does not recognize my G502 LS)?

Best regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

User avatar
MrDodel
Posts: 96
Joined: 28 Apr 2021, 09:03
Location: Event Horizon

Re: Controling Logitech LEDs with AHK

Post by MrDodel » 30 May 2022, 01:44

You can delete the unwanted DPI from the DPI Speeds profile page.
So much universe, and so little time. GNU Sir Terry.

User avatar
Scr1pter
Posts: 1271
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Controling Logitech LEDs with AHK

Post by Scr1pter » 31 May 2022, 16:00

Thanks for the hint.

Yeah, did it, I think it's impossible that the DPI can change for no reason now.

Ok, I unstalled GHub and even the Logitech Gaming Software, but AHK cannot still not control the LEDS :?: :?:
Is any additional software required??

I would give OpenRGB a chance, but I don't get it why it does not work anymore...

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

User avatar
Scr1pter
Posts: 1271
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Controling Logitech LEDs with AHK

Post by Scr1pter » 04 Jun 2022, 05:51

Stupid question:
Is it required to have the Logitech gaming software installed in order to control leds using ahk?

Yesterday I installed the lgs again and the led control (using ahk) started working again.
I have to check it today again if it still will be working.

When there was neither ghub nor lgs installed,
my keyboard just had some rgb led effect.

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

User avatar
MrDodel
Posts: 96
Joined: 28 Apr 2021, 09:03
Location: Event Horizon

Re: Controling Logitech LEDs with AHK

Post by MrDodel » 05 Jun 2022, 13:02

Scr1pter wrote:
04 Jun 2022, 05:51
Stupid question:
Is it required to have the Logitech gaming software installed in order to control leds using ahk?

Yesterday I installed the lgs again and the led control (using ahk) started working again.
I have to check it today again if it still will be working.

When there was neither ghub nor lgs installed,
my keyboard just had some rgb led effect.

Cheers!
I have a G502 Mouse, G910 Keyboard, and a G935 headset, I've always had to use either LGS or G Hub for any interaction with them.

You could try giving https://www.project-aurora.com/ a go, I still think it requires the Logitech core drivers though.
So much universe, and so little time. GNU Sir Terry.

Post Reply

Return to “Ask for Help (v1)”