Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

Post gaming related scripts
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

20 Nov 2017, 17:10

Just figured this out...
You know if you want to use your logitech device (eg Mouse or G13) with AutoHotkey, you need to map your device to a key, which autohotkey then responds to, but you need to work out which keys are not going to interfere, or use modifiers (which causes more problems).
I have the solution!
I worked out how to add keys F13-F24 (Yes, they really do exist as keys, but are basically unused these days) to Logitech Gaming software.
You have AutoHotkey SEND these keys as LGS is in it's bind screen, and then it adds it to the profile and you can have your device send them.
However, you cannot just do like `F1::F24` as LGS just responds to F1, so... you can add a delay.

F1::
Sleep 2000
Send {F24}
return

Bingo.
Unfortunately though, it appears adding F24 as a key to one profile does not make it available in another - adding it to lots of profiles will get laborious, so I wrote a script to do it.

Code: Select all

#NoEnv
#Singleinstance, Force
CoordMode, Mouse, Screen
SetKeyDelay, 50, 50

OKLocated := 0

F1::
	MouseGetPos, x1, y1
	Loop 12 {
		MouseMove, x1, y1
		Click
		num := A_Index + 12
		Sleep 250
		Send % "{F" num "}"
		if (OKLocated){
			MouseClick, Left, x2, y2
		} else {
			; Wait for user to click OK
			KeyWait, LButton, D
			KeyWait, LButton
			; Record coords
			MouseGetPos, x2, y2
			OKLocated := 1
		}
	}
	return
Open a profile in LGS, position the mouse cursor over the + by "Commands" on the left and hit F1.
It Sends F13, and then waits for you to click OK.
It remembers where you clicked OK, then adds the other 11 bindings automatically

Image

So now you can just do *F24::GoSub, DoSomethingInteresting in your AHK scripts and trigger it with buttons on your device, safe in the knowledge that it should not interfere with anything, and totally independently of the state of any modifiers if desired.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

20 Nov 2017, 18:20

Saved! It's always a nuisance to assign those keys in LGS, but so rewarding having them available in AHK.
(Great presentation too)
Acecool
Posts: 38
Joined: 10 Jan 2016, 18:25
Contact:

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

03 Dec 2017, 02:05

Cheers, but you don't need to add it to more than one profile... After you add it to one, you can simply ctrl / shift click the F keys in the box on the left-hand side and drag / drop them on the profile at the top-right. They'll be copied to each profile you drag them to.

I wrote a simple script to replace shift + f1 through f12 as f13 through f24 but the software kept picking up on it so this is nice. I did have to change the sleep though because it was moving quicker than the Logitech Software...
-Josh 'Acecool' Moser
I teach various programming languages, game programming, etc... I am also taking on programming jobs as my health allows.
Redgard
Posts: 1
Joined: 07 Jan 2018, 03:19

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

07 Jan 2018, 03:24

Hello

I've created an account just to thank you.
Thank you very much, I've been looking for this for so long!

kind regard,
Red'
Buzzerb
Posts: 4
Joined: 21 Jan 2018, 01:34

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

21 Jan 2018, 01:39

Hey man, i love the program but unfortunately it doesn't work for onboard memory programs due to a different system. I attempted to adapt your program to work but it did not, any ideas?
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

21 Jan 2018, 13:44

Hmm, I see your problem - there is no "library" of commands in onboard mode, so you need some system to send the keys on-demand.

Make a GUI that lets you select 13-24 and add a hotkey that clicks the mouse, then sends the F key that was selected in the gui.
So then you would place the mouse over the thing you want to bind and hit the hotkey.
lint_kid
Posts: 1
Joined: 04 Mar 2018, 20:50

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

04 Mar 2018, 21:09

A way that worked for me with the on board memory configuration, was to comment out SendMode Input at the top and just use F1::F24
User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

11 Apr 2018, 22:32

thanks for this, I set my scripts to use my logitech mouse's extra button as F24
BUT, I have a question which I asked in another topic too.
Can the logitech mouse use the extra button to send the F24 button and cycle my DPI settings?
I am looking for a way for AHK to track the extra button whenever I click it so it can inform me which is the currently active DPI setting. otherwise I ll have to open the mouse's control panel to view it every time I play a game.
Pontiac76

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

10 May 2018, 15:37

Excellent. Much better than the method I came up with ages ago. Putting this code into my SVN so I don't lose it.
SandLight

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

23 Jul 2018, 16:14

lint_kid wrote:A way that worked for me with the on board memory configuration, was to comment out SendMode Input at the top and just use F1::F24
Do you have any full examples of the script you used? I tried it but it doesn't work for me. Also, what version of Logitech Gaming Software were you using?
User avatar
wernerml
Posts: 5
Joined: 27 Nov 2013, 13:40
Location: Brazil

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

01 Aug 2018, 14:34

OHHH BOY... what an amazing idea!!! works like a charm!

THANK YOU!!!!!!!
dadidoo
Posts: 16
Joined: 07 Dec 2019, 23:16

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

07 Apr 2020, 04:01

hi, i have a g502 , in the game i play, the mouse macro from the logitech software is not detected, but the macro ahk that i use in the keyboard, is detected, do you have any idea how to make some kind of BRIDGE? so i can use the mouse macro from a bind in my keyboard that calls this Mousebutton? i cannot find this logitech mouse buttons in AHK, i think i read they are exclusive from the logitech software, maybe any idea? calling this buttons through another programming language? i dont understand why mouse macro is not detected as cheat but the keyboard is. thanks in advance!:D
Athanasius
Posts: 1
Joined: 29 May 2024, 08:28
Contact:

Re: Logitech Gaming Software F13-F24 enabler (Unused keys to trigger AHK actions)

29 May 2024, 08:37

Almost 7 years later ...

I have a Logitech G600 mouse, and have stuck with LGS rather than LGHub for managing it in Windows. But now I'm thinking about giving gaming on Linux another go so wanted to ensure I could utilise the side pad of 12 buttons there. At someone else's suggestion I decided setting them to F13-F24 would be a good way to do this. Obviously this has to be with the on-board profiles.

So, I ran into the same issue as Buzzerb. LGS's dialogue just seems to bypass AutoHotkey and sees 'F1' if you press it, even if there's an AHK script saying to send something else instead. You don't even get the AHK 'Send' output as well.

My solution was fairly simple, although a little tedious (keep in mind I'm totally new to AHK):
  • I realised that the LGS dialogue is literally only for key presses it doesn't catch any mouse events.
  • Thus I decided to use AHK to remap Mbutton (middle mouse button).
  • Not knowing how to set up something to change the output per invocation I ended up with 12 scripts, one for each of these Fkeys.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
SetKeyDelay 50, 50

; Only if the Logitech Gaming Software is focused
#HotIf WinActive("ahk_exe LCore.exe")
; When Middle Mouse Button is pressed, send F13 after a delay
MButton::
{
        Sleep 200
        SendEvent "{F13}"
}
Yes, this could probably just be

Code: Select all

MButton::F13
but by this stage I'd been trying all manner of things in order to get this working. I can confirm this works, I'm not sure about any more terse version.

So, now I have my main on-board profile which is set up for Web Browser operations (open tab, close tab, next/prev tab etc), a second one with these FKeys on the 4x3 pad, and a third with numpad keys (because apparently some games don't recognise FKeys past F12).

Hopefully this is helpful to someone.

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 13 guests