Description
Do you often use Windows Explorer to open folders? Perhaps it’s a folder for this year's Excel spreadsheets or a folder that contains downloads. Desktop shortcuts can be used to access popular folders, but doing so means having to minimize all of your open windows, locating the shortcut, clicking the shortcut icon, and then reopening all of your active windows again. If you find yourself doing this often, the Enterpad/AHK combo will be a time-saver.
With this simple AutoHotkey script, the folder will open in front of all of your open windows, without you having to minimize them, locate the desktop shortcut, or search for the actual folder.
Steps
1
Prepare your overlay
Choose an unassigned key on the Enterpad where you will assign the folder shortcut. Name it something appropriate, like the folder name.
2
Code installation
Copy and paste the script below in your AutoHotkey script template (Enterpad.ahk) at the location of the key you wish to assign. Replace the path in the code (C:\Users\John Doe\Documents\ThisYear) with the path of your folder. To get the path, you can open the folder in Windows Explorer and then copy it from the address bar at the top.
002: run Explorer "C:\Users\John Doe\Documents\ThisYear" return
More Info
Special characters
Spaces in the path name won’t cause a problem. However, should your path contain AutoHotkey characters with special meaning, such as ( ` ), ( % ), ( , ), or ( ; ), you will need to prefix them with a backtick ( ` ). For example, if ( % ) appears in the path name, you will need to add a backtick before it, like this ( `% ).
To make things easier, you may want to use the following script (and maybe save it as a key on your Enterpad) to automatically add backticks before any special characters in a path name that has been copied to your Windows clipboard. It will also insert the converted path name in your AHK script (wherever your cursor happens to be):
AhkFriendlyPath := RegExReplace(Clipboard, "(``|`%|`,|`;)", "``$1") SendInput {raw}%AhkFriendlyPath% return
Options
The "Access a folder" script runs File Explorer with its default options. You can set useful options after "Explorer" on the same line of code. The following example starts File Explorer with the "ThisYear" folder selected:
run Explorer /select`,"c:\users\John Doe\Documents\ThisYear"
You can find out more about Windows Explorer options at http://www.geoffchappell.com/studies/windows/shell/explorer/cmdline.htm.
Environment variables
Some AutoHotkey environment variables can be useful for defining the path name. The following example opens the current user's "My Documents\ThisYear" folder:
run Explorer "%A_MyDocuments%\ThisYear"
You can find all the AutoHotkey environment variables at https://www.autohotkey.com/docs/Variables.htm.