Rebinding a laptop´s specific key

Get help with using AutoHotkey and its commands and hotkeys
Posts: 1
Joined: 25 Apr 2019, 02:44

Rebinding a laptop´s specific key

25 Apr 2019, 02:50


I just started using AutoHotKey on my new Matebook 13.
I´d like to rebind the key that usually opens the Huawei Update App.
It´s the 4th key in the upper row from the left: https /image/huawei-matebook-13-review-3-2-720x720.jpg Broken Link for safety
It works without pressing the FN key, if you want to use F10 you have to press FN aswell.
How do I use this key to launch a special app?

Thanks for the help.

Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Rebinding a laptop´s specific key

25 Apr 2019, 03:46

Run this TooltipKeypress script:

Code: Select all

CoordMode, ToolTip, Screen
SetFormat, IntegerFast, H

CleanTimer := -3000	; 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 h100,
Gui, Show

  SetTimer, CleanText, Off
  Sleep, 50
  Key := RegExReplace(A_ThisHotkey, "^..")    	; "^.." removes the first 2 characters ("~*") from the returned string
  KeyVK := GetKeyVK(Key)
  KeyVK := RegExReplace(KeyVK, "^..")
  KeySC := GetKeySC(Key)
  KeySC := RegExReplace(KeySC, "^..")
  Text .= Key
  ToolTip, % "Key Name: {" Key "}`nKey VK: {vk" KeyVK "}`nKey SC: {sc" KeySC "}`n`n" Text, 0, 0  ; X\Y coordinates
  SetTimer, CleanText, %CleanTimer%

  Text := ""

Press the key that you're talking about it and note what the tooltip says that the VK or SC code is, then create a hotkey for it in your own script, like so:

Code: Select all

    ; Stuff to do when the button is pressed
If, for whatever reason, the above script doesn't return anything, AHK's documentation for an alternative method is here:

Return to “Ask For Help”

Who is online

Users browsing this forum: ElDunco, Flipeador, Google [Bot], KamanaMMO, TheBeginner and 191 guests