Skip to Content

Developer Toolbox - AutoHotkey

Today’s tool is AutoHotkey.

AutoHotkey is a free, open-source utility for Windows. With it, you can automate almost anything by sending keystrokes and mouse clicks.

AutoHotkey is one of those tools whose usage is only limited to your imagination. Checkout the tutorial on their website to get started with the basics:

  • Creating a script
  • Launching a program or document
  • Sending keystrokes and mouse clicks
  • Activating and manipulating windows
  • Getting input from the user with MsgBox, InputBox, etc.
  • Using variables and the clipboard
  • Repeating a series of actions over and over
  • Manipulating files and folders

After installing you basically edit a simple text file and start programming your keys.

A few examples of scripts I have setup:

:::bat :*:;cmt:: FormatTime, TimeString, ShortDate Send, %TimeString% - Jim Priest - my@email address return

When I enter ‘;cmt’ - it will write a time string for me - great to insert in comments! While I could do that within CFEclipse with a snippet the nice thing about using an AutoHotkey script is I can use it anywhere: DDL scripts, Ant scripts, email, etc.

Speaking of CFEclipse - here is a shortcut I have mapped to my F6 key to launch it quickly:

:::bat SC040:: Run C:\eclipse-3.3\eclipse.exe -vm “C:\Program Files\Java\jre1.5.0_11\bin\javaw” vmargs -Xms512m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=128m return

(SC040 is the code for my F6 key on my Microsoft Ergo keyboard)

For a more complicated example this one will wrap any text I have selected with a cfdump and cfabort. Great for those debugging sessions!

:::bat SC03B:: clipboard = send ^c clipwait, 1 If ErrorLevel = 0 { clipboard = `n send ^v } return

Again I could do that with a snippet but sometimes I find myself tinkering with a file in Notepad.

The online documentation is great and if you run into problems I’d suggest posting your question to the helpful user forum.

I’ve just briefly covered what you can do with AutoHotkey in this post but it is much more powerful. You can build extremely complex mini-applications with dialog windows, user interaction and more. The wiki also has a nice list of scripts available.