Getting More Productive with AutoHotKey

by Robert Borgersen, Mathematics Recipient of 2012 University 1 Excellence in Teaching Award
What is it? AutoHotKey is a Windows program designed to allow for automation of your machine by writing scripts that run on their own, or that can be set to respond to keyboard, mouse, or even joystick input. How do I get it? Visit www.autohotkey.com and download the newest version. It’s small and won’t take long to get. Once you get it, there’s not much to see - you haven’t got any scripts yet. But what if I use a Mac? AutoHotKey is Windows only, but you should check out Automator (which comes with OS X) or Applescript, which came with earlier versions. So what do I do with it? In short, anything you want! The coding will take a little practice if you don’t have much programming experience, but they have tried to keep it easy enough so it doesn’t take too much to learn, and their online documentation is really well done (http://www.autohotkey.com/docs/). What I’ll give you here are some ideas that you could use it for and some scripts I’ve found useful. Use #1: Evernote / Launching Apps. I use Evernote a lot and wanted to be able to launch it very quickly (as if I had a button on my keyboard whose job it was to launch it). Create a new file with notepad and save it as OpenEvernote.ahk. Then enter the following code and save it:

Technology for Education

^e:: IfWinExist, ahk_class ENMainFrame WinActivate Else Run Evernote.exe, %A_ProgramFiles%\Evernote\Evernote\ Return

Once you save it, double click on the file OpenEvernote.ahk. Now, whenever you press Ctrl+e, Evernote will open (even if it’s not already running!). All that’s left is to put OpenEvernote.ahk (or a shortcut to it) in your StartUp Directory so it will always be available to you. I’ve been using this for a year or so and it comes in very handy, and of course this can be edited to open any program with a keypress. If you need some help doing so, shoot me an email and I’d be happy to help. Use #2: My To Do List. I use a website called GQueues (http://www.gqueues.com) to manage what I have to do. To increase my productivity, I wrote a script that would open my GQueues window and then, once it’s open, press “Q” which activates a “Quick Add” box the site has allowing me to enter my to do item. The script is run by me pressing Ctrl+Q (using AutoHotKey), and so whenever something comes up that I need to add to my to do list, I press Ctrl+Q, and within 1 second I can enter it without touching the mouse. You can see the code at http:// bit.ly/ToTXkh. Note that the code can be modified for any todo list application (whether online or local) in similar ways. 24 VOLUME 21 No. 1 FALL 2012

Use #3: Text Expansion. Check out the short video at http://bit.ly/ToU7rX. One of the beautiful things AutoHotKey can do is turn short text codes in to anything and everything. This can be very useful if you find yourself writing the same email over and over (think something like ‘I’m sorry, there are no ways to get extra marks…’, or “The exam is scheduled as found on the university website at...”). The idea is this: you type “email1” (or whatever text you want) into an email program (or any word processor for that matter), and as soon as you press the last character the phrase is replaced by some preset email (that could be of any length). This could work as well for creating templates of slides in education. As an example, the following code will change “btw” to “by the way”: ::btw::by the way Or, the following code will change “]d” to the current date and time: :*:]d:: FormatTime, CurrentDateTime,, yyyy-MM-dd h:mm tt SendInput %CurrentDateTime% return

A

H

K

Use #4: Remote Computing. A recent article (see http://bit.ly/OXB73o) discussed how to use AutoHotKey and DropBox (http://www.dropbox.com). Some uses include being able to pop up a message box at home to be seen by anyone walking by the computer, run any program (including other scripts and servers), shut down the machine, etc. Use #5: Gaming. I know it’s not exactly education, but just a quick note: imagine playing your favourite game with AutoHotKey installed. You can set up, say, F1 to automatically send to the game the same button 100 times in one second. This has been used to produce some amazing results in gaming (see for instance http://bit.ly/ToLg9J, http:// and http://bit.ly/ToLgq6). Use #6: Productivity. Sometimes I need to get off the computer and get some other work done, and it’s helpful if I don’t have to look at my monitors. So, I wrote a quick script to turn off the monitors when I press F12. It’s nice and short: F12:: Sleep, 100 SendMessage 0x112, 0xF170, 2,,Program Manager return

So what do I do to get started? Head over to YouTube and look up videos on using AutoHotKey. There are lots of them, and they have some great tutorials out there, from absolute beginner things to very advanced techniques and coding. More advanced users? You can make full programs with GUIs and everything! Check out http://bit.ly/QNNnEk for an intro to that. Right now, I’m looking at ways to use AutoHotKey to interact with Evernote in more powerful ways like linking directly to a tag search, using the ENScript utility included with Evernote.
As I find and start using more awesome and useful AutoHotKey scripts, I will post them on my blog at http://edtech.robertborgersen.info/, so please check it out! If you find any that you would like to share, please send them to me at Robert_Borgersen@umanitoba.ca. Keep learning!

VOLUME 21 No. 1 FALL 2012

25