Trying to simulate laptop 'fn' key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AudioBabble
Posts: 39
Joined: 16 Mar 2022, 20:38

Trying to simulate laptop 'fn' key

15 May 2024, 13:22

Hello, my laptop 'fn' key has no scan code in key history, so I took a look with AHKHID.

Apparently the 'data' for my fn key is:

Code: Select all

 ; fn Key:
;Vendor ID: 5426 Product ID: 586 Ung/Us: l/O Data: 040A0000000000000000000000000000 {down}
;Vendor ID: 5426 Product ID: 586 Ung/Us: 1/0 Data: 04000000000000000000000000000000 {up}
So... maybe this is oversimplifying the whole business, but would it be possible to send that data?

I tried this sort of thing, but it doesn't work:

Code: Select all

SendInput, {Raw}"{0x040A0000000000000000000000000000}"
Send {f1}
SendInput, {Raw}"{0x04000000000000000000000000000000}"
It just sends a normal f1 (if my fn key were in play, it would toggle my audio mute -- not that that's what I'm trying to do, just a test case)

[Mod edit: Moved topic from AHK v2 help since this post shows v1 code.]
RussF
Posts: 1298
Joined: 05 Aug 2021, 06:36

Re: Trying to simulate laptop 'fn' key

15 May 2024, 13:45

This topic has been addressed many times on these forums. The Fn key does not (as a general rule) generate any scan code that can be used by AHK. The key is intercepted and interpreted directly by the PC's BIOS. On a laptop, there is usually a toggle setting in the BIOS that will switch the function of the Fn key - one way gives you media control and special functions when it is pressed, the other gives you standard function keys. If you have a separate detached keyboard with a Fn key, there typically is nothing you can do to detect or affect it.

Russ
AudioBabble
Posts: 39
Joined: 16 Mar 2022, 20:38

Re: Trying to simulate laptop 'fn' key

15 May 2024, 14:47

Ah well... shucks!

Thanks for pointing that out.
User avatar
Chunjee
Posts: 1468
Joined: 18 Apr 2014, 19:05
Contact:

Re: Trying to simulate laptop 'fn' key

15 May 2024, 17:36

Fn takes place at the hardware level and ahk is limited to the software level. Sadly it can't be used in ahk scripts generally speaking

Russ

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: RussF and 90 guests