Using fn key as a modifier

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
enigment
Posts: 6
Joined: 04 Jan 2017, 08:17

Using fn key as a modifier

04 Jan 2017, 08:36

Hi folks, It's been a long time since I worked actively with AHK, I've just been using and occasionally tweaking the scripts I built. However, I've just moved to Windows 10, and a number of my shortcuts that were triggered by the Windows key in combination with a letter don't work right, because the Windows key is used a lot by shortcuts built into the OS.

I'd like to change these to use fn + a letter. Looking around I see that sc163 is the fn key, but for example this doesn't appear to work for fn + a:

Code: Select all

sc163 & a::
Is it possible to use the fn key as a modifier? What am I missing about how to do this?

Thanks in advance for any help.
guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: Using fn key as a modifier

04 Jan 2017, 10:12

i tried it and i couldn't get it working either

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Using fn key as a modifier

04 Jan 2017, 10:18

Try something like that, as far as I remember Fn key is not kept down state but pressed repeatedly:

Code: Select all

sc163::LastFnPress:=A_TickCount+50
#if (LastFnPress<A_TickCount)
a::MsgBox a
#if
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Using fn key as a modifier

04 Jan 2017, 10:18

Try,

Code: Select all

MsgBox, % GetKeyName("sc163")
On my computer it say Help :lol:
I don't get any output in the keyhistory when i press my fn key.
guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: Using fn key as a modifier

04 Jan 2017, 10:21

i get "Help" also. i didn't even know about the GetKeyName() func

KeyHistory shows me vkFF sc163. did you #installkeybdhook ?

interestingly, GetKeyVK("sc163") shows "2F" but keyhistory shows "FF"

Code: Select all

msgbox, % GetKeyVK("sc163")     ; shows 47 aka 0x2F

vk2Fsc163::msgbox             ; fails

vk47sc163::msgbox            ; fails

vkFFsc163::msgbox            ; works

guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: Using fn key as a modifier

04 Jan 2017, 10:36

HotKeyIt wrote:Try something like that, :

Code: Select all

sc163::LastFnPress:=A_TickCount+50
#if (LastFnPress<A_TickCount)
a::MsgBox a
#if
this didn't work for me
HotKeyIt wrote:as far as I remember Fn key is not kept down state but pressed repeatedly
if i hold down "k", KeyHistory shows repeated events. but if i hold down "Fn", KeyHistory only shows 1 event

guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: Using fn key as a modifier

04 Jan 2017, 10:43

looks like this guy had a solution but all links are dead
https://autohotkey.com/board/topic/2784 ... -solution/

qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
Contact:

Re: Using fn key as a modifier

04 Jan 2017, 10:53

enigment wrote:Is it possible to use the fn key as a modifier? What am I missing about how to do this?
ThinkPad? On my laptop, quick testing shows the Fn key can indeed be detected by AutoHotkey, but (presumably due to the way the EC is programmed to work) the letters pressed whilst Fn is held down aren't sent to Windows (at least raw input isn't picking them up).

The only workarounds I have:
  • If this wouldn't severely annoy you like it would me, enable Fn sticky key mode from the UEFI. You won't get the Fn+a combination, but you will be able to do Fn and then "a" in quick succession
  • There may be a couple of unused Fn hotkeys you can use instead. On my laptop, Fn + F1 is unused and so is the ThinkVantage key. (And Fn+F6 wants me to install the useless Lenovo Settings software.) I have the latter running an AutoHotkey script that drops down ConEmu. To check this out, use Process Monitor and set the following filters:
    • Process Name is shtctky.exe then Include
    • Path contains SOFTWARE\Lenovo\ShortcutKey\AppLaunch then Include
    If you get a hit when pressing your desired Fn+<whatever> combination, look at the other registry keys present in AppLaunch to get an idea on how to get your own script running when you press said key.
enigment
Posts: 6
Joined: 04 Jan 2017, 08:17

Re: Using fn key as a modifier

04 Jan 2017, 14:32

Thanks folks. I have a number of scripts that used Windows + something, so a modifier is really what I'm looking for, not one specific fn key that isn't used. There aren't any other keys that can be used as modifiers besides Ctrl, Alt, Shift, and Windows, are there?

If there's nothing like that, I guess I need to to trim down the tools I have available that quickly.
guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: Using fn key as a modifier

04 Jan 2017, 15:27

you could try using SHIFT+WIN+XXX instead?

+#a::msgbox

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Using fn key as a modifier

04 Jan 2017, 17:41

enigment wrote: There aren't any other keys that can be used as modifiers besides Ctrl, Alt, Shift, and Windows, are there?
See Hotkey Combinations.
enigment
Posts: 6
Joined: 04 Jan 2017, 08:17

Re: Using fn key as a modifier

05 Jan 2017, 07:55

guest3456 wrote:you could try using SHIFT+WIN+XXX instead?

+#a::msgbox
I did a combination of that (before I saw your msg actually), and removing some less frequently used items with Windows key triggers.

To me that feels better than the somewhat convoluted process required to use other keys as modifiers (though it is kind of cool that you can do that).

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Marium0505 and 340 guests