Can you remember the last time you actually used the Print Screen key? Or Caps Lock, or Insert, or, Pause Break? Hell, does anyone even know what Pause Break does? Chances are, you have a number of keys you've never even touched. Instead of letting them collect dust, why not do something awesome with them? Here's a simple way to assign common, useful actions to those unused keys, like putting your computer to sleep, showing hidden files, or ejecting a flash drive.
A lot of those keys may have useful functions built in to Windows, but if you already know the shortcuts and don't use them, let's be honest—you never will. So let's do something better with them. The nuts and bolts of this post rely on the previously mentioned, time-saving AutoHotkey (AHK) scripting language. You may have heard of it before, but since many of you don't have the time to learn a scripting language (don't worry, we understand), we've put together simple tool will let you use AHK to remap your unused keys in no time. Here's how.
Before You Start: Download the Necessary Software
First, you'll need a few small pieces of software installed on your computer:
- Download and install AutoHotkey. This is the tool that we'll use to create your custom set of hotkeys, but don't be intimidated—you won't have to learn any of the scripting language, since our tool will generate it for you.
- Click on the Start menu, go to All Programs, and scroll down to Startup. Right-click on the Startup folder and choose Open.
- Right-click anywhere in the Startup folder and select New > AutoHotkey Script. Rename it to
shortcuts.ahk
and minimize that Explorer window—you'll need to come back to it later.
Now, you're ready to get to the fun stuff: let's start building your shortcuts.
The Tool
Step 1: Select a key for your shortcut
Faded keys indicate that you've already assigned a shortcut to that key.
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Insert Print
Screen Pause/
Break Caps
Lock
Home End Page
Up Page
Down Ctrl
(Right) Alt
(Right) Shift
(Right)
Step 2: Select what you want to happen when you press that key
Faded actions indicate that you've already assigned a shortcut to that action.
Eject CD/DVD Tray Drive, Eject
Safely Remove Hardware Run, %A_WinDir%\System32\rundll32.exe shell32.dll`,Control_RunDLL hotplug.dll Toggle Hidden Files
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
If HiddenFiles_Status = 2
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
Else
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
WinGetClass, eh_Class,A
If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
send, {F5}
Else PostMessage, 0x111, 28931,,, A
Return Toggle File Extensions
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
If HiddenFiles_Status = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0
Else
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
WinGetClass, eh_Class,A
If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
send, {F5}
Else PostMessage, 0x111, 28931,,, A
Return Show Desktop Run, "%A_APPDATA%\Microsoft\Internet Explorer\Quick Launch\Shows Desktop.lnk" Open Calculator Run Calc.exe Open "My Documents" Run explorer.exe "%USERPROFILE%/My Documents" Empty the Recycle Bin
MsgBox, 4,, Are you sure you want to empty the Recycle Bin?
IfMsgBox Yes
FileRecycleEmpty
else
return
return Start Screensaver SendMessage 0x112, 0xF140, 0, , Program Manager Lock the Computer DllCall("LockWorkStation") Turn Off the Monitor SendMessage 0x112, 0xF170, 2, , Program Manager Sleep the Computer DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0) Hibernate the Computer DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0) Shut Down Run, Shutdown.exe -s -t 00 Reboot Run, Shutdown.exe -r -t 00 Volume Up Send {Volume_Up} Volume Down Send {Volume_Down} Volume Mute Send {Volume_Mute} Play/Pause Send {Media_Play_Pause} Previous Track Send {Media_Prev} Next Track Send {Media_Next}
Note: It looks like the "Safely Remove Hardware" action doesn't work correctly in Windows 7 64-bit. If anyone can think of a workaround, let us know in the comments!
Step 3: Repeat steps 1 and 2 until you're happy with your shortcuts.
Or, if you want to change something, click here to reset the tool and start over.
Step 4: When you're done pairing keys and actions, copy and paste this code into your shortcuts.ahk
file
Click to view
When you're all done, copy and paste the above code into the shortcuts.ahk
file we created in your Startup folder (under any text that's already there). Save it, double-click on it to run it, and start trying out your shortcuts. If everything went well, you should have a fresh, new set of hotkeys ready to make your days easier and your life more productive!
Going Further: Creating Shortcuts for Your Favorite Apps, Folders, and More
So you've got a few hotkeys, but maybe you've been inspired to tweak a few for your own uses. Maybe you want to launch another one of your favorite programs, or set the F keys to open up all your favorite folders. It's actually very easy to do—just dig into that script and edit it yourself. We've already talked about how to write in AutoHotkey's super simple langage before, but the basic structure goes like this:
Hotkey::Action I want it to take
So, if we look at the Calculator example above, we can tweak it to launch Firefox just by trading calc.exe
for firefox.exe
:
F1::Run firefox.exe
Simple, huh? Similarly, if we wanted to open our Dropbox folder instead of My Documents, we could just swap out My Documents in the action we provided in the tool:
F1::Run explorer.exe "C:\Users\YOURUSERNAME\Dropbox"
See AutoHotkey's documentation to see more hotkeys you can use, more actions you can run, and more cool ideas. Be sure to also check out the best time-saving AutoHotkey tricks you should be using, and check out the AutoHotkey forums for some other really cool stuff. I'd also recommend checking out free app Nircmd—it can do a lot of cool stuff and it makes AutoHotkey much, much easier to use. Now that you've gotten started, the world is your oyster—you'd be surprised some of the awesome shortcuts you can make.
Got any of your own favorite AutoHotkey tricks, shortcuts, and scripts? Share them with us in the comments below.
Photo remixed from Thaiview, Carlos A. Oliveras, Molodec, and cg artist (Shutterstock).
No comments:
Post a Comment