using the F1-F12 key without the FN key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PixiePin
Posts: 5
Joined: 30 Nov 2020, 07:20

using the F1-F12 key without the FN key

30 Nov 2020, 07:42

Good day everyone,

I need help changing the behavior of the keyboard with the FN key. In the production hall, we use the keyboard for the CMC machine, which is controlled mainly by the F1-F12 keys. Unfortunately, for the F1-F12 key to work, the Fn key must be pressed each time. This is very annoying and slows down the work. Usually the worker has only one free hand. I need the keyboard to behave exactly the opposite. That is, when I want to increase the volume, brightness, backlight, etc. so that I have to use the Fn key, and when I want to use F1-F12, I don't have to press the Fn key. Now it's just the opposite and it's terrible. Many thanks to everyone who is willing to advise.
User avatar
mikeyww
Posts: 26847
Joined: 09 Sep 2014, 18:38

Re: using the F1-F12 key without the FN key

30 Nov 2020, 07:51

Advice: get a different keyboard! :) You'll make back the $25 quickly in time saved.

Fn is not usually configurable. One post about it is below.

https://www.autohotkey.com/boards/viewtopic.php?f=76&t=81807
PixiePin
Posts: 5
Joined: 30 Nov 2020, 07:20

Re: using the F1-F12 key without the FN key

30 Nov 2020, 08:47

I need a special keyboard for the production line, which has a maximum width of 41 cm. and the HP Pavilion 300 Keyboard is the only one keyboard that corresponds to the given parameter. I looked on HP support forums and here is nothing.

I found the code, but eg. I need to press the code fn + F5 when pressing F5. It is impossible?

This code maybe help:

Code: Select all

; F1 | Mute 
VOLUME_MUTE::F1
F1::VOLUME_MUTE

; F2 | Volume Down 
VOLUME_DOWN::F2
F2::VOLUME_DOWN

; F3 | Volume Up
VOLUME_UP::F3
F3::VOLUME_UP

; F4 | Last Song
MEDIA_PREV::F4
F4::MEDIA_PREV

; F5 | Play/Pause
MEDIA_PLAY_PAUSE::F5
F5::MEDIA_PLAY_PAUSE

; F6 | Next song
MEDIA_NEXT::F6
F6::MEDIA_NEXT

; F7 | Brightness Down


; F8 | Brightness Up


; F9 | Search
BROWSER_SEARCH::F9
F9::BROWSER_SEARCH

; F10 | Toggle display mode for multi-screen
<#Tab::
SendInput {F10}
Return
				
; F11 | ???
<^<#F21::
SendInput {F11}
Return

; F12 | System Settings
<#F21::
SendInput {F12}
Return
[Mod edit: [code][/code] tags added.]
User avatar
mikeyww
Posts: 26847
Joined: 09 Sep 2014, 18:38

Re: using the F1-F12 key without the FN key

30 Nov 2020, 08:51

Some good news. This might be configurable in the BIOS.

https://support.hp.com/in-en/document/c02035108

Change the action key setting from the BIOS Setup Utility.

1. Shut down the computer.
2. Turn on the computer and immediately press F10 repeatedly, to open the BIOS Setup Utility.
3. Press Right or Left, to select the System Configuration menu.
4. Press Up or Down, to select Action Keys Mode.
5. Press Enter, to display the Enabled / Disabled options.

c02035200.jpg
c02035200.jpg (28.26 KiB) Viewed 11303 times

6. Press Up or Down, to select one of the options.

Enabled: Does not require pressing fn to use the actions printed on the function keys.
For example, pressing f8 lowers the sound as printed on the key. Alternately, pressing both the fn + f8 minimizes and maximizes a web browser.

Disabled: Requires pressing fn to use the actions printed on the function keys.
For example, pressing f1 opens a help window. Alternately, pressing both the fn + f1 keys puts the computer to sleep as printed on the key.

7. Press F10 to save the selection and restart the computer.
PixiePin
Posts: 5
Joined: 30 Nov 2020, 07:20

Re: using the F1-F12 key without the FN key

30 Nov 2020, 09:27

Yes, I found this option, unfortunately the PC is not originally built for the FN keyboard and there is no this option in the BIOS. That's why I'm trying for something equivalent like FN lock. I've been looking for a lot of advice and help and I'm not alone with this problem, on HP forums a lot of users write that they can't do it too and HP writes that this keyboard has it on purpose so that it can't be done, it's a multimedia keyboard. That's why I want to use AutoHotKey or something similar.
User avatar
mikeyww
Posts: 26847
Joined: 09 Sep 2014, 18:38

Re: using the F1-F12 key without the FN key

30 Nov 2020, 09:38

You could try the scan code info from instructions in the other post. It might (might not) work, but could be worth a go.
PixiePin
Posts: 5
Joined: 30 Nov 2020, 07:20

Re: using the F1-F12 key without the FN key

30 Nov 2020, 09:59

Isn't there any way to write a script that keeps the FN key pressed? Or something like F1:: fn + F1 (F1:: fn & F1), I don't know how to write it, I'm in contact with AHK today for the first time and programming is not my strong point. I don't know how to write in AHK Fn, and also if it means the connection fn & F1 etc.

https://www.autohotkey.com/docs/KeyList.htm Here is nothing about FN keys
User avatar
mikeyww
Posts: 26847
Joined: 09 Sep 2014, 18:38

Re: using the F1-F12 key without the FN key

30 Nov 2020, 10:06

You want to see if your computer registers the key. These are the instructions from the page.

1. Ensure that at least one script is running that is using the keyboard hook. You can tell if a script has the keyboard hook by opening its main window and selecting "View->Key history" from the menu bar. [You can just run a script containing #InstallKeybdHook.]
2. Double-click that script's tray icon to open its main window.
3. Press Fn.
4. Select the menu item "View->Key history", or press Ctrl+k. [If you were already viewing it, press F5 to refresh.]
5. Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot directly make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. For possible solutions, see further below....
6. If your key is detectable, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. 159).

The point of this is that if your Fn does not generate an event, then you cannot use AHK to control the key, unless one of the alternate solutions works.
hhabi
Posts: 1
Joined: 07 Dec 2021, 23:24

Re: using the F1-F12 key without the FN key

07 Dec 2021, 23:44

Hi it is possible. I have a DELL laptop Inspiron 15 3000. When i simply press F1, it changes the volume. But when i press FN+F1 it sends "Ctrl+L, which i programmed below

Code: Select all

F1::
Send ^l
return
Clarifying to make the above code work, i have to press FN+F1, which is tiresome. Why two keys(FN and F1) when one will do?
BUT THERE IS A SOLUTION
So to work around this, i found the solution.
1. Go to this page https://www.autohotkey.com/board/topic/38015-ahkhid-an-ahk-implementation-of-the-hid-functions/
2. Click on Download and copy paste the script to notepad, save it to ahkid.ahk
3. Go back and click on Example 2 and copy paste the script to notepad and save it as example2.ahk
In the example2.ahk, add the following in the beginning

Code: Select all

#include ahkid.ahk
It will look like

Code: Select all

#include ahkid.ahk
/*! TheGood
    AHKHID - An AHK implementation of the HID functions.
    AHKHID Example 2
    Last updated: August 22nd, 2010
Save example2.ahk
Run example2.ahk
In the GUI, which appears enter UsagePage 1 and UsagePage 6. Click on Add. Then click on Call.
If you do it correctly, each time a key in keyboard is pressed you can see a message appearing there
Image
The first line is when i pressed h on keyboard.
The third and fourth line came when i simply pressed f1 on keyboard (with no FN combination)
So i found that my f1 keycode is 173 which must be converted to hexadecimal.
The hexadecimal equivalent of 173 is ad.
So code goes like this

Code: Select all

VKAd:: ; f1
Send ^l
return
Now it is complete. SIMPLY PRESS F1 and "Ctrl+L" is send.
sunofivo
Posts: 1
Joined: 06 Sep 2022, 11:15

Re: using the F1-F12 key without the FN key

06 Sep 2022, 11:21

I know this is late, but found this looking for a solution to my problem:
remap other keys on that keyboard to send F1-F12
like
1::F1
2::F2

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998, MrDoge and 238 guests