Logitech G513 FN key inversion script Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Logitech G513 FN key inversion script

29 Oct 2019, 17:29

Hi to everyone!

I decided to register at your board as I was thinking about AutoHotkey as the last possible solution for a trouble (imo) with Logitech G513 keyboard. Maybe I'm wrong and it's not even possible due to technical limitations with FN key programming, but it's worth checking it with you guys. I'm using AutoHotkey and run simple scripts couple of years now, like keyboard & mouse lock while cleaning 'em, blocking ALT + TAB while gaming, and couple of other which I've found on internet in the past. I love your very light program, even if coding is magic to me. I don't want even imagine how harder the life behind the desk would be without your program. To the point...

This keyboard has double functions under F5-F12, Print Screen, Scroll Lock & Pause while the FN key is pressed. It has even a FN inversion switch in the main software of which you can skip to press the FN key to use any of their secondary functions. The question is, if it's possible with an AutoHotkey script to enable FN inversion for some of these buttons and disable for some? It's a PITA to use this keyboard sometimes as I'm using FN inversion switch enabled to simply hit F9-F12, Print Screen, Scroll Lock & Paus to control my audio/video media, but i the inversion works even for F5-F8 at the same time. I'd like to have it enabled for F9-F12 Print Screen, Scroll Lock & Paus and disabled for F5-F9 so the FN for them need to be pressed.

Thanks in advance.
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

30 Oct 2019, 06:04

According to the documentation regarding multimedia keys: "The function assigned to each of the keys listed below can be overridden by modifying the Windows registry." Apparently, normal keyboard remapping/hotkeys via AHK will not affect these multimedia keys.

You could potentially map F5 to Launch_Media, F6 to Media_Prev, etc., and vice-versa using RegWrite or directly using the Registry Editor in Windows. I haven't tested it since I don't like messing with the registry when I don't have to, but you may want to try it.
User avatar
Bugz000
Posts: 93
Joined: 30 Sep 2013, 10:01

Re: Logitech G513 FN key inversion script

30 Oct 2019, 06:56

for some alternatives you can get the scancodes of the keys and remap as you wish i'm sure,

also check this out https://autohotkey.com/board/topic/10145-keytweak-remap-keys-registry-scancode/
Image
||-------[-HP-ML350E-G8-]-------||-[-32-core-xeon-]-||--[-48gb-ECC-]--||
||----[-Dell-Poweredge-r610-]---||-[-16-core-xeon-]-||--[-16gb-ECC-]--||
||-[-Lenovo-ThinkPad-x201-tab-]-||---[-4-core-i7-]--||-[-8gb-nonECC-]-||
||---------------------------[-shack--img-]---------------------------||
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

08 Nov 2019, 03:32

I don't think you understand it right, guys? Is there something unclear with what I wrote? I don't want to remap any key. The keyboard already has multimedia keys and they're working as they should, with exception that I need to hold FN key to trigger them (if the FN inversion mode in Logitech software is disabled as per default) which isn't so comfortable for me. I just want to enable automatically FN button triggering only with multimedia keys and they are - F9-F12, Print Screen, Scroll Lock, Pause, but NOT to be automatically triggered while hitting F5-F8. It's all about FN inversion key, not re-programming any other key.

Here is a screen of the keyboard look:
Image

Bugz000 wrote: for some alternatives you can get the scancodes of the keys and remap as you wish i'm sure,

also check this out https://autohotkey.com/board/topic/10145-keytweak-remap-keys-registry-scancode/
Link inside this thread is dead.
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

08 Nov 2019, 08:38

It is you that is not understanding why we are talking about remapping keys, not our understanding what you want. Whether it's F5-F8 or F9-F12, the function keys of interest would be remapped from their normal state (without FN being held down) to those keys with the FN key held down (or to their media function directly). That would allow you press them without holding the FN key and they would behave as if you did.

For example: If you never used the ` character but often used the ~ character, you might want to not have to press the Shift key to get the ~ character. You would accomplish that with a remapping even though they're the same key and the only difference is whether you hold a modifier key or not. Like this:

Code: Select all

`::~
Understand?
gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Logitech G513 FN key inversion script

08 Nov 2019, 14:48

boiler wrote:
30 Oct 2019, 06:04
According to the documentation regarding multimedia keys: "The function assigned to each of the keys listed below can be overridden by modifying the Windows registry." Apparently, normal keyboard remapping/hotkeys via AHK will not affect these multimedia keys.
I am actually surprised to read this - I never noticed the mention of the registry before at the top of the 'multimedia keys' section. On the 10 Euro-keyboard I am currently using, I can actually remap the nine buttons of this group that I have (and remap to them), like other buttons... I can't talk for the Logitech G513, though.

So that works here:

Code: Select all

F9::Media_Play_Pause
F10::Media_Next
F11::Volume_Up
F12::Volume_Mute
Of course, you could make these togglable with #If[...]-directives and creating context-sensitive hotkeys.

Apart from that: what boiler said.

PS: keytweak can be found here: https://www.bleepingcomputer.com/download/keytweak/ (among other places)
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

08 Nov 2019, 16:09

gregster wrote:
08 Nov 2019, 14:48
So that works here:

Code: Select all

F9::Media_Play_Pause
F10::Media_Next
F11::Volume_Up
F12::Volume_Mute
Of course, you could make these togglable with #If[...]-directives and creating context-sensitive hotkeys.
Glad to see that. I only tried it with F5::Launch_Media, which didn't work for me (perhaps because I need to associate a media player with it), and I wrongly assumed that the others wouldn't work either, but I see now that they do for me as well. That is exactly what I was hoping when I said maybe they could be remapped to their media function directly. When the one didn't work, I also assumed it was because of what I found in the documentation, but that seems like it applies if trying to map in the other direction. Thanks for correcting me and straightening this out. :thumbup:
gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Logitech G513 FN key inversion script

08 Nov 2019, 16:18

Actually, remappings in the other direction work for me too, for example:

Code: Select all

Media_Play_Pause::F9
Media_Next::F10
I use some similar (context-specific remappings) for a long time now. That's why I was especially surprised about the mentioning of the registry.
Now I might check with another keyboard that I have... perhaps I am just lucky with my high-end keyboard :) It might not be generally applicable.
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

08 Nov 2019, 16:27

gregster wrote:
08 Nov 2019, 16:18
I use some similar (context-specific remappings) for a long time now. That's why I was especially surprised about the mentioning of the registry.
Now I might check with another keyboard that I have... perhaps I am just lucky with my high-end keyboard :) It might not be generally applicable.
That also worked for me. That part of the documentation I quoted may mean something other than how I interpreted it, like hooking them to other media functions that aren't necessarily linked to a keyboard key already. Thanks again.
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

11 Nov 2019, 16:01

Thank you for your input, guys. I'm a new(bie) to remapping keys... and don't really know how and where to start. I've scanned for couple of entries in the registry so far, (I'm using RegScanner) like Browser_Home and PrintScreen, but got no matches. I assume it will be the same for all other keys. What is the next step I should do?
gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Logitech G513 FN key inversion script

11 Nov 2019, 16:33

Like I said, I don't use the registry at all for this on my keyboard (but I just use a 10 Euro keyboard, not a Logitech G513) - that's the whole point of AHK remappings, not editing the registry for things like this (among many other things, nowadays ;) )

I would first try to remap specific F-keys to the media functions that you want them to execute, like:

Code: Select all

F9::Media_Play_Pause
F10::Media_Next
F11::Volume_Up
F12::Volume_Mute
so that they do these things - without inverting them at all. So you could still use F5 to F8 like usually while other F-keys would change the volume or skip to the next track. You could then forget about the Fn key...

As I understand, you haven't tried this yet...?!

(If that works, you can easily make them togglable via #If.)
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

18 Nov 2019, 05:56

You're genius guys! It worked flawless :bravo: Here's a modified code for Logitech G513 keyboard. Thank you sooooo much. Life is so much easier now :P

Code: Select all

F9::Media_Play_Pause
F10::Media_Stop
F11::Media_Prev
F12::Media_Next
PrintScreen::Volume_Mute
ScrollLock::Volume_Down
Pause::Volume_Up
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

22 Nov 2019, 16:57

There's one more thing. It's not working when Windows 10 screen is locked. Is it possible to change it?
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

25 Nov 2019, 16:56

Guys, this isn't working 100% as intended. Except not working script while Windows is locked, it's not working with shortcuts neither. Can't use any shortcut related to any of these keys, for example CTRL + F9, F10, F11 and F12. How to solve it?
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

25 Nov 2019, 17:09

Try making them hotkeys instead of remappings:

Code: Select all

F9::Send, {Media_Play_Pause}
F10::Send, {Media_Stop}
F11::Send, {Media_Prev}
F12::Send, {Media_Next}
PrintScreen::Send, {Volume_Mute}
ScrollLock::Send, {Volume_Down}
Pause::Send, {Volume_Up}
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

25 Nov 2019, 17:29

Thank you. It worked for shortcuts. Do you have any solution for locked screen?
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

25 Nov 2019, 19:51

don_dolarson wrote:
25 Nov 2019, 17:29
Thank you. It worked for shortcuts. Do you have any solution for locked screen?
You're welcome. I personally do not know how to make this work when Windows is locked. I believe there isn't really a solution to this, but perhaps someone else knows otherwise.
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

09 Dec 2019, 10:42

There's one more thing - ALT keys. They're needed for ALT + PRTSC for taking hotkey screenshots. ALT + PRTSC control media now, just like the CTRL key did. Tried about 15-20 minutes to figure out how to modify on my own (thanks for hotlinks in your script above), but this scripting thing isn't my strongest point.
Would you mind include this key for me please?
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Logitech G513 FN key inversion script

09 Dec 2019, 11:24

Even when you are using the hotkey version (the one that has Send in it) instead of a remap (the one without), you're not able to capture the image of a window using Alt+PrintScreen? It should still work since the hotkey should only be invoked when pressed unmodified (without Alt or any other modifier key). That's how it's supposed to work, and that's how it works on my machine.
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Logitech G513 FN key inversion script

10 Dec 2019, 16:58

Yes sir, I'm using the version with Send in it. It looks like ALT doesn't work with any of these mapped keys at all. I can still use F9-F12, Prtsc, Scrlk & Pause even when pressed & hold Alt key and that's why ALT + Prtsc doesn't work. It's exactly how Ctrl worked before, before you put the Send in it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], sbrady19 and 134 guests