Help with functions keys Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TheLimboDrifter19

Help with functions keys

18 Jan 2018, 10:09

My keyboard requires me to press the 'fn' button to utilise the function keys or else they have different attributes assigned to the like increasing/decreasing brightness, volume, etc. I want to use the scripts to assign the function keys to number keys like,1,2,3 and so on. For example, I want the computer to process the F1 key when I press Ctrl + 1. I know that ^ is for Ctrl but what do I type to get the 'Send' command to execute the F1 or other function keys?
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Help with functions keys  Topic is solved

18 Jan 2018, 17:34

First of all, I would simply try:

Code: Select all

Ctrl & 1::Send, {F1}
If that doesn't cut it, try running the following script...

Code: Select all

CoordMode, ToolTip, Screen

CleanTimer := -1000	; Must be a negative number (the timer will run only once)

Loop, 5000
{
  Hotkey, % "~*" GetKeyName(Format("vk{:x}", a_index - 1)), GetText
  Hotkey, % "~*" GetKeyName(Format("sc{:x}", a_index - 1)), GetText
}
  ; "~" keeps the button original function
  ; "*" fires the hotkey even if extra modifiers are being held down

Gui, New, -MinimizeBox
Gui, Add, Edit, w200 h200,
Gui, Show
Return

GetText:
  SetTimer, CleanText, Off
  Sleep, 50
  Key := RegExReplace(A_ThisHotkey, "^..")    	; "^.." removes the first 2 characters ("~*") from the returned string
  If StrLen(Key) > 1
    Key := "{" Key "}"
  Text .= Key
  ToolTip, % "" . Key "`n`n" . Text, 0, 0	; X\Y coordinates
  SetTimer, CleanText, %CleanTimer%
Return

CleanText:
  Text := ""
  ToolTip
Return

GuiClose:
  ExitApp
Return
...pressing the Fn key in the window and seeing if it displays anything in the tooltip in the upper left hand corner of the screen. If it does, then try:

Code: Select all

Ctrl & 1::Send, {Fn down}{F1}{Fn up}
...replacing "Fn" with whatever was between the braces in the tooltip.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada and 262 guests