Map ‘Fn’ + ‘Home’ to Screen Brightness Using AutoHotKey

key-bindingkeyboardkeyboard shortcutslaptop

Could someone please show me what script code I would need to map my laptop "fn" key + "home" to lower the screen brightness (and subsequently "fn" + end to increase).

I know I can reach the screen brightness using this control panel link:

Control Panel\Hardware and Sound\Power Options

but I don't know how I could get the "screen brightness" scrollbar to move horizontally each time I press ?

Best Answer

Autohotkey offers a great possibility to find the "number" of the key:

If your keyboard or mouse has a key not listed above, you might still be able to make it a hotkey by using the following steps (requires Windows XP/2000/NT or later):

  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.
  2. Double-click that script's tray icon to open its main window.
  3. Press one of the "mystery keys" on your keyboard.
  4. Select the menu item "View->Key history"
  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 detectible, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. 159).
  7. To define this key as a hotkey, follow this example:

    SC159:: ; Replace 159 with your key's value.
    MsgBox, %A_ThisHotKey% was pressed.
    return

So it's very easy to find the numbers of your keys and script a shortcut to increase the brightness.

Related Question