Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Using AHK to remap the Function (Fn) F5 button.


  • Please log in to reply
16 replies to this topic
hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009
I am trying to use AutoHotKey to remap the Fn + F5 button to do something other than turning on and off the Wirelss Signal. (I am using a IMB Lenovo Thinkpad R61). I know how to make it where pressing the Function key opens up a specified "Run" command, but I cannot figure out how to run something with pressing Fn and another button. I know the Scan Codes for both keys I am trying to use.

HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
As far as I understand Fn & F5 and other Fn hotkeys are kind of hardcoded, so you cannot override or simulate those :(

Wingfat
  • Members
  • 937 posts
  • Last active: Oct 14 2015 04:20 PM
  • Joined: 23 Aug 2004

I know how to make it where pressing the Function key opens up a specified "Run" command, but I cannot figure out how to run something with pressing Fn and another button.


Does it have to be the Fn and F6 keys? sounds like you want to map something to a key combo of two keys or more. Why not use something like Ctrl + Alt + 6 and leave out the whole Fn and Fkeys???
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------

hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009

I know how to make it where pressing the Function key opens up a specified "Run" command, but I cannot figure out how to run something with pressing Fn and another button.


Does it have to be the Fn and F6 keys? sounds like you want to map something to a key combo of two keys or more. Why not use something like Ctrl + Alt + 6 and leave out the whole Fn and Fkeys???


I am trying to remap the command that is set when pressing the Function and the F5 key. Right now, it pulls up the Wirelss Signal Menu, where you can shut off your wireless. I am trying to make it where users running the script will not be able to shut off their wireless using the Fn F5 key.

...............
And Hotkey, so you are saying that you cannot overide the commands already set for the various function keys?

Wingfat
  • Members
  • 937 posts
  • Last active: Oct 14 2015 04:20 PM
  • Joined: 23 Aug 2004
ah ha.. i see.
you can use WinKill to kill the program that pops up to change the Wifi on and off.
use the windwos Spy program to get the correct name of that app that comes up.

IfWinExist, Untitled - Notepad
    WinKill ; use the window found above

----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------

hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009
Also, alternatively, if I could not remap that key, would there be a way to make a different hot key act as the same function of some of the Fn keys. I can shut off all the Fn keys alltogether, but some of them are useful to the group of users, I just want to shut off Fn F5. Commands such as turning brightness more or less? Basically, doing the same commands that the Fn keys do, just using a different hotkey such as the Windows key or Ctrl key.

hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009

ah ha.. i see.
you can use WinKill to kill the program that pops up to change the Wifi on and off.
use the windwos Spy program to get the correct name of that app that comes up.

IfWinExist, Untitled - Notepad
    WinKill ; use the window found above


I like this idea, and it might work, except for when you press Fn F5, you can set it to where just pressing those buttons automatically switchs your wireless off. Normally a menu comes up first, but you can have it set to where the menu does not come up and it automatically switches the wireless radio. So if users had the setting enabled where the menu didn't pop up, they could still shut their wireless off. At least it seems that way to me.

Wingfat
  • Members
  • 937 posts
  • Last active: Oct 14 2015 04:20 PM
  • Joined: 23 Aug 2004
try out:
F5:: 
this makes F5 a hot key that will send nothing. that might block that key input all together...might..

also if you are putting this on end user machines.. you can add in at the top of the script:
#NoTrayIcon ; Make no Icon on System Tray for Users to close out
Also if you complie the program renaming it something like svchost.exe will make it hard for an end user to find that app in their Task Manager to close it.
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------

hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009
I don't think I quite understand what you mean by that. Are you just saying that putting F5:: will give it no value? If so, it doesn't apply because pressing down the fn button uses a different scan code.

Wingfat
  • Members
  • 937 posts
  • Last active: Oct 14 2015 04:20 PM
  • Joined: 23 Aug 2004
can you copy that code with Windows Spy or something so we can try to write a script to block that input?
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------

hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009

can you copy that code with Windows Spy or something so we can try to write a script to block that input?


I don't have a program such as Windows Spy, is there something else I can do?

Wingfat
  • Members
  • 937 posts
  • Last active: Oct 14 2015 04:20 PM
  • Joined: 23 Aug 2004
if you have AHK installed you should have a program called AU3_Spy.exe in the main AutoHotKey folder.. that or try using the AutoScriptWriter and press the Fn F5 combo and see what it captures.
----------------------------
Wingfool you fat! I mean, Wingfat you fool!
Line from Woody Allen's movie "What's Up Tiger Lilly?"
-----------------------------

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Mystery of the Fn-key

It's a backup from this thread.

HTH

fn fn-key function key remapping

hatmatbbat10
  • Members
  • 7 posts
  • Last active: Oct 02 2009 03:31 AM
  • Joined: 30 Sep 2009
This is what shows up when pressing Fn F5 using AutoScriptWriter.
WinWait, Change Power Settings of Wireless Radios, Fn + F5 &Settings...
IfWinNotActive, Change Power Settings of Wireless Radios, Fn + F5 &Settings..., WinActivate, Change Power Settings of Wireless Radios, Fn + F5 &Settings...
WinWaitActive, Change Power Settings of Wireless Radios, Fn + F5 &Settings...
Send, {SHIFTDOWN}{SHIFTUP}

.............

I have read through the Mystery of Functions keys several times, and still cannot find the answer I am looking for.

n-l-i-d
  • Guests
  • Last active:
  • Joined: --

I have read through the Mystery of Functions keys several times, and still cannot find the answer I am looking for.


You did? Did you see this?

Step 3: Creating hotkeys

Congratulations! Once you've successfully completed the previous two steps, your Fn key is fully functional and ready to be remapped. I'll discuss two functions, one for the Fn key where it acts as a modifier, and one for the Eject key.
;
; Fn + Backspace = Delete
;
$Backspace::hotkeyBS()

hotkeyBS() {
global fnPressed
if (fnPressed = 1) {
Send {Delete}
} else {
Send {Backspace}
}
}
Return


HTH