ASCIi Group
The Fun of Creating Tools
by Hank Pearson
January, 2007
It's fun to create tools to simplify your computer tasks. You might find writing them is easier than thinking of what you want to automate.
No matter what I would pick as an example, I can hear you (or someone) say, "I don't need that. The task doesn't bother me. The example doesn't apply."
The task doesn't bother me either, but creativity is rewarding. This article is not about specific examples. It's about the joy of writing your own tools.
Sure, you can buy almost any kind of software you can think of. And you can probably even find it free. But there is a special pleasure in making something yourself, no matter how simple.
Abbreviations and Misspelled Words
Let's say you run a company called Purple Mountain Majesty. You have to type that several times a day in various applications.
So you write a command that allows you to abbreviate it pmm:
::pmm::Purple Mountain Majesty
That's all there is to it! Now, every time you type pmm, your script types Purple Mountain Majesty. You can put a bunch of these hotstring commands in your script file: commonly misspelled words, your name and address - anything that speeds up your typing.
Mouse Wheel on Keyboard
Do you find yourself reaching for the mouse several times a day to roll the wheel a little? You'd like that functionality on the keyboard? No problem. Here are your hotkey commands:
#Down::Send {WheelDown}
#Up::Send {WheelUp}
Now, when you hold down the Windows key (next to Alt) and press the Down or Up arrow, the mouse wheel rolls (effectively) without taking your hands off the keyboard.
Timestamp Email or Documents
In Notepad, you can press F5 to insert the time and date. How about a hotkey that timestamps any document or email message (in any program)? Here's how:
#t::
FormatTime, TimeString,
, h:mm tt ddd MMMM d, yyyy
Send %TimeString%
return
When you press Win+T (when you hold down the Windows key and press the T key), your script types something like
7:35 PM Tue January 9, 2007
Flexible Formatting
The top and bottom lines
#t::
return
say that when you hold down the Windows key (represented by #) and press t, do the following, and then return to normal processing.
FormatTime, TimeString,
says to format the date and time, and put the result in a string of characters called TimeString.
You can format the date and/or time about any way you like.
For example,
yyyyy-MM-dd dddd HH:mm
produces
2007-01-09 Tuesday 19:35
Send %TimeString%
sends the contents of the string to the keyboard, as if typed.
Pick a Language
What language is being used in these commands?
AutoHotKey. AutoHotKey is
free, it is
easy, and it is
powerful. See the online article
AutoHotKey FAQ - Getting Started
(
asciigroup.org/articles/autohotkey)
Plain English
Perhaps the hardest thing about using AutoHotKey or any other scripting language is getting started. Simply think what you want the script to do and write quick notes in plain English, something like this:
When I type pmm, I want the computer to type Purple Mountain Majesty.
When I press Win+Down or Win+Up, I want the mouse wheel to roll.
When I press Win+T, I want the computer to type the date and time.
That's called pseudocode but don't let the big word scare you. Write it any informal way you like. Just get the idea down as soon as you can, before you forget what you want.
Then, if you like, chop the text into short lines if that makes it easier to understand.
Yes, you could skip the pseudocode, but it will help you get started.
Not Just Hotkeys
Is AutoHotKey limited to hotkeys? Not at all. You can write GUIs (graphical user interfaces) if you like. But hotkeys are much simpler to write and faster to use.
Any Modifier Key
Are hotkeys limited to using the Windows key for the modifier or prefix key? No. Not only can you use the standard Ctrl, Alt, Shift, and Win keys - you can use any key as a modifier. So you could, for example, hold down the zero key on the numeric keypad and press the plus key to do whatever you specify. And you could still use those keys as usual.
Memory Aid
Do hotkeys turn you off because they are hard to remember? Write a command that pops up some notes:
#/::run C:
otes.txt
Then, as long as you can remember a single hotkey, you can easily get to your notes.
In the example, #/ is the Windows key and the slash, much like typing a question mark, but using Win instead of Shift.
Type some notes and save the file as notes.txt (or notes.doc if your .doc files load fast enough). You might as well add a few Windows shortcut keys to your file if you have a hard time remembering them. Here's a sample notes.txt:
| Win+Slash |
notes.txt
|
| pmm |
Purple Mountain Majesty
|
| Win+Down |
mouse wheel down
|
| Win+Up |
mouse wheel up
|
| Win+T |
timestamp
|
| Alt+Tab |
switch applications
|
| Win+D |
Desktop
|
| Win+E |
Explorer |
Yes, you could use real sticky notes (which get messy and fall off and get lost). Or you could download a sticky note program. But you wouldn't get the pleasure of writing it yourself.
Have Fun
Don't be afraid to brainstorm with your friends in the local computer user group. And don't forget to search the web for examples, tips, and forums. It's fun to create your own tools. The most important point: get started now. Make a note.
Related article:
AutoHotKey FAQ
lists Frequently Asked Questions such as where to get the free AutoHotKey and how to start using it. Includes several links to helpful resources.