Getting Translators to Code I – A Gentle Introduction to AutoHotkey

Smart translators work smart. Smart translators can afford to be lazy. Smart and lazy translators, however, are efficient, as they are always looking for easier, simpler and faster ways to get the job done. And what’s wrong with trying to get the job done with the least effort? Finding clever solutions to make your work easier will eventually save you loads of time. It will also prevent you from making some of the mistakes humans inevitably make all the time.

In the spirit of trying to help you succeed at being a lazier (thus smarter) translator, here is a simple introduction to AutoHotkey, a scripting language for desktop automation, which in my opinion is both powerful and relatively simple to understand, especially for non-technical folks.

In a nutshell, the idea is that you can have AutoHotkey do the repetitive manual work for you. What currently takes you 10 minutes can probably take seconds if automated.

And I’m not talking only about translation; think about all the different tasks a typical translator will do on a regular day, like file management, email, research, data tracking. etc.

One of the things you can do with AutoHotkey (after you have downloaded it from http://www.autohotkey.com/ and installed it) is creating hotstrings. A hotstring replaces an abbreviation with a longer phrase or sentence – similar in a way to an auto-replace feature. For example, if you want to avoid typing “Terms & Conditions” in your translation a hundred times, you could just create a hotstring that replaces some short text like “tc” with “Terms & Conditions”.

Or, if you are tired of typing the same 10 different email addresses of your workmates, you could have a hotstring replacing something like “@@@” with “juan@email.com”. With this, not only you save yourself some time, but also typos (and stress, probably).

How would this work? Create a new text file and type the hotstring surrounded with 2 pairs of colons, followed with the replacement sentence. Example:

::tc::Terms & Conditions
::@@@::juan@mail.com; silvio@mail.com; tanya@mail.com;alan@mail.com; jose@email.com

Save the file with any name, but make sure you use AHK as the file extension (just do Save us in your text editor). If you double-click the saved file, the script will run in the background, and anytime you type a hotstring, it will get replaced. You can even put this file in your Windows Startup folder so it runs every time you start your computer.

Easy, right? Let’s take it a step further. Say you want to have a shortcut that:

  1. Open a New Message in Outlook
  2. Adds all the email addresses we mentioned before to the To field,
  3. Adds the text “Daily update” to the Subject, and
  4. Moves the cursor to the body of the email so you can start typing.

For this, you can simply tell AutoHotkey to “press” the same keys you would while following these steps. Keystrokes can be sent using the Send command, followed by the key names in curly brackets.

This is how it works:

^e::    #this stands for Control + e; this is the shortcut you can press to run this script. You can use any combination of control keys and regular key you want to use.

Send {ctrl down}     #this means “keep the Control key pressed”

Send n    # Send an “N” keystroke – remember, Control+N = new email in Outlook

Send {ctrl up}    # Release the Control key

Sendinput, juan@ebay.com; silvio@ebay.com; tanya@ebay.com;alan@ebay.com    #You can use Sendinput to let Autohotkey know that this is string of text, not keys

Send {Tab}

Send {Tab}    #press Tab key 2 times, to move the cursor to the Subject field

Sendinput, Daily Update    #This text will be added to the Subject field

Send {Tab}    #To move the cursor to the body of your message

Remember, if you want to use this script, save it in a file with the AHK extension, for example, myscript.ahk. While the file is running, you’ll be able to use any defined shortcuts to run all these actions. Also, and very important, you can have more than one script in a file – that means you can run several “shortcuts” from the same file.

Keep in mind that this is just a simple example to help everybody understand how these scripts work. Just as we created a script to “automate” the steps to create an email, similar scripts can be used to, for example, control your CAT tool, manipulate your files, do global search and replace operations, and so much more.

In the next post, I’ll show you how to create a script to do Google and other searches in your favorite reference sites using shortcuts directly from whatever document or window you are using.

Advertisements

6 Comments Add yours

  1. Sam says:

    Thanks very much! The Outlook example is very useful and clearly explained.
    i look forward to more of these!

    Liked by 1 person

    1. J. Rowda says:

      Thanks, SAM! More posts coming soon!

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s