Friday, February 4, 2011

Improve Your Productivity with AutoHotKey

I’ve been meaning to write something about using the AutoHotKey utility to increase productivity.  Then I saw this article in LifeHacker which prompted me to get started:

How to Make Your Caps Lock Key Search the Web, Chrome OS-Style

If you haven’t heard about AutoHotKey, it’s a program that runs in your task bar that lets you create your own hotkeys.  I never use the caps lock key, so AuthoHotKey let me change its behavior and put the wasted button to good use.  Now whenever I press caps lock, Windows starts a new tab in Chrome and moves the focus to the address bar so it’s ready for a new search.

My other use for AutoHotKey is to improve my typing speed when writing SQL queries.  I spend a lot of time at work writing SQL code in the SQL Server Management Studio.  Because of this, I’ve typed “SELECT * FROM” a countless number of times.  With AutoHotKey, I’ve defined “Windows Key + Z” as a keyboard shortcut that will type this for me.

Here’s what my AutoHotKey script looks like so you can get started with your own script:

#z::Send SELECT * FROM{Space}

; Add some media keyboard shortcuts since my laptop doesn’t have them…
#.::Send {Media_Next}
#,::Send {Media_Prev}
#/::Send {Media_Play_Pause}

; Fix one of my common typing errors…

; Create a new tab in chrome when caps lock is pressed.  Note that you’ll have to
; change the path to Chrome on your computer… (Copied from the LifeHacker article)
SetTitleMatchMode, 2
If WinExist("ahk_class Chrome_WidgetWin_0")
Send ^t
Send ^l
Run "C:\Users\your_user_name\AppData\Local\Google\Chrome\Application\chrome.exe"
sleep 100
Send ^t
Send ^l