Make Function Keys and Power User Menu Shortcut using AutoHotKey Script
I recently bought a Filco Majestouch Ninja mechanical keyboard. It doesn’t come with all the fancy function keys, therefore I decided to create some function keys myself. I installed the AutoHotKey (AHK) tool and wrote an AHK script. I use the Windows key as a replacement for the Function (Fn) key typically found on laptop keyboards. Here is a list of my function key mappings.
Shortcut | Functions |
---|---|
Win+Esc | Put computer to sleep |
Win+F6 | Toggle volume mute |
Win+F7 | Turn master volume down |
Win+F8 | Turn master volume up |
Win+F9 | Skip to previous song |
Win+F10 | Play or pause song |
Win+F11 | Skip to next song |
Win+F12 | Open Network And Sharing Center |
I use a Windows 7 on my desktop, but I found the Power User Menu shortcuts in Windows 8 come in handy, so I created them too. The Power User Menu is the pop-up menu which is displayed on the bottom left corner when you press Win+X
on a Windows 8 computer. The script will not display the menu, so you need to remember the shortcut keys.
Shortcut | Functions |
---|---|
Win+X, F | Program and Features |
Win+X, B | Mobility Center |
Win+X, O | Power Pptions |
Win+X, V | Event Viewer |
Win+X, Y | System |
Win+X, M | Device Manager |
Win+X, K | Disk Management |
Win+X, G | Computer Management |
Win+X, C | Command Prompt |
Win+X, A | Command Prompt (Admin) |
Win+X, T | Task Manager |
Win+X, P | Control Panel |
Win+X, E | Explorer |
Win+X, S | Search |
Win+X, R | Run |
Win+X, D | Desktop |
Here goes the script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Put computer to sleep (Win + Esc) | |
#Esc:: | |
; Sleep/Suspend: | |
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0) | |
; Hibernate: | |
;DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0) | |
Return | |
;; Volume control | |
; Toggle mute (Win + F6) | |
#F6::Send {Volume_Mute} | |
; Turn master volume down (Win + F7) | |
#F7::Send {Volume_Down} | |
; Turn master volume up (Win + F8) | |
#F8::Send {Volume_Up} | |
;; Media control | |
; Prev song (Win + F9) | |
#F9::Send {Media_Prev} | |
; Play or pause (Win + F10) | |
#F10::Send {Media_Play_Pause} | |
; Next song (Win + F11) | |
#F11::Send {Media_Next} | |
; Show Network control panel (Win + F12) | |
#F12::Run, %windir%\system32\control.exe /name Microsoft.NetworkandSharingCenter | |
; Shutdown (Win + Ctrl + F12) | |
#^F12::Run, shutdown /s /t 0 | |
;; Emulate Windows 8 Power User Menu, i.e Win+X Menu | |
#x:: | |
Input Key, L1 T3 | |
; Desktop | |
if Key = d | |
Run, %windir%\explorer.exe shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257} | |
; Run | |
else if Key = r | |
Run, %windir%\explorer.exe shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0} | |
; Search | |
else if Key = s | |
Run, %windir%\explorer.exe shell:::{2559a1f8-21d7-11d4-bdaf-00c04f60b9f0} | |
; Explorer | |
else if Key = e | |
Run, %windir%\explorer.exe /e,::{20D04FE0-3AEA-1069-A2D8-08002B30309D} | |
; Control Panel | |
else if Key = p | |
Run, %windir%\system32\control.exe | |
; Task Manager | |
else if Key = t | |
Run, %windir%\system32\taskmgr.exe /0 | |
; Command Prompt (Admin) | |
else if Key = a | |
DllCall("shell32\ShellExecute", "uint", 0, "str", "runas", "str", "C:\Windows\System32\cmd.exe", "str", "", "str", "", "int", 1) | |
; Command Prompt | |
else if Key = c | |
;Run, %windir%\system32\cmd.exe | |
DllCall("shell32\ShellExecute", "uint", 0, "str", "open", "str", "C:\Windows\System32\cmd.exe", "str", "", "str", HOMEDRIVE . HOMEPATH, "int", 1) | |
; Computer Management | |
else if Key = g | |
Run, %windir%\system32\compmgmt.msc | |
; Disk Management | |
else if Key = k | |
Run, %windir%\system32\diskmgmt.msc | |
; Device Manager | |
else if Key = m | |
Run, %windir%\system32\control.exe /name Microsoft.DeviceManager | |
; System | |
else if Key = y | |
Run, %windir%\system32\control.exe /name Microsoft.System | |
; Event Viewer | |
else if Key = v | |
Run, %windir%\system32\eventvwr.exe | |
; Power Options | |
else if Key = o | |
Run, %windir%\system32\control.exe /name Microsoft.PowerOptions | |
; Mobility Center | |
else if Key = b | |
Run, %windir%\system32\mblctr.exe | |
; Programs and Features | |
else if Key = f | |
Run, %windir%\system32\control.exe /name Microsoft.ProgramsAndFeatures | |
return |
Read other posts
comments powered by Disqus