I’ve been using Autohotkey for keyboard macros for a while now. I find it virtually indispensable to work quickly and productively. It rocks.
Here are the most useful macros I use on a regular basis, lifted straight from my AutoHotkey.ahk:
; hit ctrl-space to make the current window always on top. From http://www.labnol.org/software/tutorials/keep-window-always-on-top/5213/
^SPACE:: Winset, Alwaysontop, , A
:o:..3::My address
:o:..4::415-…My phone number
:o:..9::94110
^!r:: ; Run gedit with Ctrl-Alt-r
;IfWinExist, Notepad++
; I found the name of the window by using “AutoIt3 Window Spy”, which comes with autohotkey
IfWinExist, ahk_class gdkWindowToplevel
WinActivate
else
Run, “C:\Program Files\gedit\bin\gedit.exe”
return
^!c:: ; Run Calc with Ctrl-Alt-c
IfWinExist, Moffsoft FreeCalc
WinActivate
else
; Run, calc.exe
Run, “C:\Program Files\Moffsoft FreeCalc\MoffFreeCalc.exe”
return
^!t:: ; Run Truecrypt with Ctrl-Alt-t
IfWinExist, TrueCrypt
WinActivate
else
; Run, calc.exe
Run, “C:\Documents and Settings\Lee\Desktop\My Truecrypt file.tc”
return
^!d:: ; Run Chrome with Ctrl-Alt-d
IfWinExist, New Tab – Google Chrome ; If there is already a blank window, bring it to front
{
WinActivate, New Tab – Google Chrome
}
else
{
IfWinExist, ahk_class Chrome_WidgetWin_0 ; grab a Chrome window and click ctrl-n to make a new window
{
WinActivate
Send ^n
}
}
WinWaitActive, New Tab – Google Chrome, , 1 ; wait to see if the command worked
IfWinNotExist, New Tab – Google Chrome ; if we don’t have a new chrome window by now (IE, clicking ctrl-n didn’t work) then
start it manually
{
Run, “C:\Documents and Settings\Lee\Local Settings\Application Data\Google\Chrome\Application\chrome.exe”
WinWait, New Tab – Google Chrome, , 3
WinActivate, New Tab – Google Chrome
}
return
^!w:: ; Run Windows Explorer with Ctrl-Alt-w
IfWinExist, My Documents
Run, explorer.exe
else
Run, explorer.exe
return
:o:.address::My full address{enter}San Francisco, CA 94110{enter}
:0:.80::123456789012345678901234567890123456 >40< 3456789012345678901234567890123456 >80{enter}
:o:.–::{- 50}{down}{home}
:o:.-=::{- 50}{enter}
:o:.=-::{enter}{- 50}{ENTER}{- 50}{down}{home}
:o:.==::{enter}{- 50}{ENTER}{- 50}{enter}
:o:.ms::——– Original Message ————-{enter}
:o:.me::——– End of Original Message ——{enter}
:o:.ss::—- Start of Snippet —-{home}{down}
:o:.se::—- End of Snippet —-{enter}
:o:.s::San Francisco
:o:.sc::San Francisco, CA
:o:.c:: California
:o:.b::Berkeley
:o:.bc::Berkeley, CA
:o:.date:: ; This hotstring replaces “]d” with the current date and time.
FormatTime, CurrentDateTime,, M/d/yyyy h:mm tt ; It will look like 9/1/2005 3:53 PM
SetKeyDelay 0 ; This sets the keystrokes below to be sent faster than the default.
Send %CurrentDateTime%
return
To get you excited in case you can’t read this configuration file, here are some examples:
:o:..3::My address
I type “..3(Return)” and it replaces that text with my street address. I use this all the time when buying stuff on websites. Oh, it’s a “3” because my address starts with a 3, making it easy to remember
^!d:: ; Run Chrome with Ctrl-Alt-d
…
I hit Control-Alt-D and it starts Google Chrome. Or if there is already a blank Chrome window open, it gives it the focus. This is sooo much faster than picking up the mouse and clicking the icon a thousand times a day.
^!c:: ; Run Calc with Ctrl-Alt-c
Pull up the calculator with a quick key combination
:o:.ms::——– Original Message ————-{enter}
I type “.ms” (short for “message start”) and it replaces it with, well, I’ll let you guess. Similarly, “.me” is short for “message end”.