AutoHotKey (called AHK by its fans) is a scripting language, very tightly integrated with Windows. Its most powerful and salient feature is an excellent ability to hook onto events of the Windows OS - most notably keystrokes and mouse clicks and movements. This is the "hotkey" ability which makes it most popular:
  • Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse or keyboard macro by hand or use the macro recorder.
  • Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.
  • Expand abbreviations as you type them. For example, typing "btw" can automatically produce "by the way".
  • Remap keys and buttons on your keyboard, joystick, and mouse.
  • Use a joystick or keyboard as a mouse.
  • Alleviate RSI with substitutes for Alt-Tab (using keys, mouse wheel, or buttons).
But AHK is more than this. Under the hood, you discover an amazingly powerful wrapper of the Win32 API - enabling to write Windows GUI applications (or front-ends to applications) is no time, with very little programming knowledge. I played with AHK for a couple of days, and already have the following utilities in my arsenal:
  1. Useful shortcuts for working in Windows Explorer: a hotkey to create a new text file, one to create a new directory, and one to open "cmd" inside the directory that is currently explored.
  2. Remapping the [ and ] keys to ( and ), respectively, only when in the SciTE editor editing Lisp files. This helps me manage RSI of holding the SHIFT all the time.
  3. A favorite folders popup menu. In any window, a shortcut of keyboard+mouse opens a popup menu with a list of the directories I defined as favorite. A click on one, opens a new Windows Explorer in that directory. If I'm already in a Explorer, it jumps to the directory without opening a new one. If inside a cmd shell, "cd" to that directory. This amazing little utility saves a lot of time.
The playability and customizability of AHK is nearly infinite - the forums are bursting with useful scripts and ideas. I will definitely be on the lookout from now on for things to automate. This makes working on a Windows computer much more bearable, just the knowledge of AHK being there to help with any need gives me a feeling of power. AHK is great in many ways, here is an incomplete list of things I especially like about it:
  1. It is so simple to create new keyboard/mouse shortcuts. Just think it - and it takes 5 seconds to add to your AHK script.
  2. The integration into Windows is really wonderful. AHK comes with a utility named Window Spy that helps in the task of discovering active windows and window classes, to ease the development of scripts. AHK easily binds to any DLL, so any Win32 API function is called trivially.
  3. Complex and pretty GUIs are very easy to create (something like Tk in terms of ease). Such GUIs can serve as front-ends to common tasks or GUI-less applications.
  4. AHK is very small and "compilable" - you easily create an executable weighing less than 200k - and use it on any machine without AHK installed !
  5. The community is very active, friendly and enthusiastic - the forum is an excellent play to get quick help.
  6. AHK is open source - C++ source is downloadable.
  7. The documentation is terrific - every feature is meticulously documented in the accompanying CHM file, and much more can be found by simply searching the forum archives.
  8. Last but not least - the author Chris Mallett is very active and responsive to users. New releases with bug fixes are frequent, so are new features.
Not everything is pink, however. AHK has one big problem (the only one I can think of, really) - its scripting language. Although non-programmatic users don't seem to mind, to professional programmers experienced in other languages AHK is simply scary. The following is a partial list:
  1. Assembly like labels with data sharing by global variables.
  2. Although functions are available, AHK system calls use labels.
  3. The syntax is unusual and non-intuitive - no doubt made for simple parsing (without a real parser)
  4. There is no simple way to combine multiple scripts together - you generally have to spill everything into a single large script (except perhaps for library functions).
  5. There are no arrays. Running-count variables are used instead !! (elem1, elem2, elem3...)
I must note, though, that the situation is constantly improving. Chris is steadily adding normal programming features - like functions with local and static variables, true expressioins, etc. Therefore, there is every reason to be optimistic. I would never write complete applications in AHK - it is too painful, although many people do it (just look at the forum - people really write amazing stuff in this language). For its tasks - hotkeys, simple GUI front-ends, Windows event processing, it is good enough, and steadily getting better. If it continues this way, the prognosis for AHK is very good. Highly recommended to try!

Comments

comments powered by Disqus