I have a Bluetooth keyboard that is great for switching between my laptop and PC. I like it a lot, but by default, it sets function keys to media keys, and I have to press the "Fn" key (which is between the right CTRL and ALT GR) and a LOCK button (that is to the right of F12). This switches the function keys so that they act like F1, to F12. However, after about 3 minutes of inactivity, the lock releases and F1 to F12 go back to the multimedia functions(!). I do not want that, and I've looked at the site; there is no way to fix this functionality.
I would like AutoHotkey to help me to make the function keys act as normal function keys at all times.
I'm thinking that remapping the keycode of the function keys to F1 to F12 might be best? But how can I capture those codes and remap them? When I open Window Spy, I thought I could press a key and it would show up here, but I do not see that.
The multimedia mappings on this keyboard are as follows:
F1 => Mute
F2 => Vol Down
F3 => Vol Up
F4 => Rewind
F5 => Play/Pause
F6 => Forward
F7 => Brightness Down
F8 => Brightness Up
F9 => Select All
F10 => Copy
F11 => Paste
F12 => Cut
But I guess it's all dependent on detecting what happens when those keys are pressed...
Alternatively, maybe there is a way to trigger the "Fn + Lock" key function that turns on the Lock (indicated by a green light on a unique key on the keyboard above the NumPad). If I can detect if that Lock LED is on every 2 minutes, and then turn it on if it's not; is that a possible option, and how could we achieve that?
Would really appreciate some code on how to achieve this kind of mapping in practice / how to discover the key codes?
How to map keys on multimedia keyboard?
Re: How to map keys on multimedia keyboard?
Hello,
Many laptop computers provide a robust solution in allowing you to set the default for how the function keys work. It is a toggle, indicating whether you want the function keys to default to the F keys or the other functions. This setting is typically in the BIOS configuration, so I would look for it there, and then toggle it. It will then set your Fn + Lock, preserving it through reboots.
Many laptop computers provide a robust solution in allowing you to set the default for how the function keys work. It is a toggle, indicating whether you want the function keys to default to the F keys or the other functions. This setting is typically in the BIOS configuration, so I would look for it there, and then toggle it. It will then set your Fn + Lock, preserving it through reboots.
Re: How to map keys on multimedia keyboard?
Thanks Mikey, but this is a standalone Bluetooth keyboard that I use on my desk and I switch between my laptop and my desktop. As I said in the above, there is a lock function but it unlocks after 3-5 minutes of activity, and having to repress this lock has proven to be a constant hassle. I just want normal function keys to be the default at all times.
My laptop keyboard is different. As you say, it has a lock function that does not expire, so I can set that to multimedia or to normal function keys and it stays that way. But the bluetooth keyboard operates in a different (and frustrating) way. I do like this bluetooth keyboard, but this problem is something that I have not been able to solve (including emails with the vendor).
I feel fairly sure that AutoHotkey should be able to handle this, from what I know of its functionality, but I don't know where to start in defining how these keys should act differently when I press them. Any help would be great.
My laptop keyboard is different. As you say, it has a lock function that does not expire, so I can set that to multimedia or to normal function keys and it stays that way. But the bluetooth keyboard operates in a different (and frustrating) way. I do like this bluetooth keyboard, but this problem is something that I have not been able to solve (including emails with the vendor).
I feel fairly sure that AutoHotkey should be able to handle this, from what I know of its functionality, but I don't know where to start in defining how these keys should act differently when I press them. Any help would be great.
Re: How to map keys on multimedia keyboard?
Sure, you can remap like this or the opposite.
Below is a page that lists the keys.
https://www.autohotkey.com/docs/v1/KeyList.htm#multimedia
This might not work for every key. You can also see if there is a scan code, and check the KeyHistory to see if a key is sending a specific sequence that could be used as a hotkey in AHK.
There is a script or library called AutoHotInterception that may also be useful in distinguishing devices.
Code: Select all
#Requires AutoHotkey v1.1.33
Volume_Down::F1
https://www.autohotkey.com/docs/v1/KeyList.htm#multimedia
This might not work for every key. You can also see if there is a scan code, and check the KeyHistory to see if a key is sending a specific sequence that could be used as a hotkey in AHK.
There is a script or library called AutoHotInterception that may also be useful in distinguishing devices.
Re: How to map keys on multimedia keyboard?
This are great, thanks.
I can only make it work for F1 to F6 so far unfortunately, but it's a start... AutoHotInterception looks very interesting. Hopefully I can get something from that, but looks quite complex
Can you think of an approach for CTRL+a / c / v / x? I doubt that I can map CTRL~a to F12 as that will interfere if I do a normal CTRL+a.
Here is the output from KeyHistory for F7 to F12
I can only make it work for F1 to F6 so far unfortunately, but it's a start... AutoHotInterception looks very interesting. Hopefully I can get something from that, but looks quite complex
Can you think of an approach for CTRL+a / c / v / x? I doubt that I can map CTRL~a to F12 as that will interfere if I do a normal CTRL+a.
Code: Select all
Volume_Mute:: F1
Volume_Down:: F2
Volume_Up:: F3
Media_Prev:: F4
Media_Play_Pause:: F5
Media_Next:: F6
; Brightness_Down:: F7 ; does not register in in KeyHistory
; Brightness_Up:: F8 ; does not register in in KeyHistory
; Select_All: F9 ; maps to CTRL+a
; Copy:: F10 ; maps to CTRL+c
; Paste:: F11 ; maps to CTRL+v
; Cut:: F12 ; maps to CTRL+x
Code: Select all
F7 => Brightness down, this does not show any entries
F8 => Brightness up, this does not show any entries
F9 => select all
A2 01D d 0.70 LControl
41 01E d 0.00 a
A2 01D u 0.08 LControl
41 01E u 0.03 a
This is F10 => copy
A2 01D d 0.63 LControl
43 02E d 0.05 c
A2 01D u 0.11 LControl
43 02E u 0.00 c
This is F11 => paste
Can't see this because when I press it, the KeyHistory window closes
This is F12 => cut
Presumably similar to select all / copy above
Re: How to map keys on multimedia keyboard?
Code: Select all
#Requires AutoHotkey v1.1.33
^c::Send {F10}
^v::Send {F11}
^x::Send {F12}