Efficiency Tips for Translators: AutoHotkey (for Windows)

VeronikaFor TranslatorsLeave a Comment

Console showing (partially fake) AutoHotkey code.

AutoHotkey is one of those incredibly useful and versatile tools I use daily that hardly anyone I have worked with in the translation industry over the years had ever heard of. It’s a little powerful program that works with scripts and (mostly) does what you ask it to do. It’s a willing little helper. You certainly don’t have to be a translator to find it helpful and in this article I will show you that you don’t need to be a programmer either.

What can AutoHotkey do exactly?

AutoHotkey is a powerful scripting language so the possibilities are practically endless. Here are a few simple things you can do fairly easily:

People with a much better understanding of AutoHotkey describe much more advanced things in the comments to this Lifehacker article like a script to remind them to get up every 20 minutes to stretch or a script that immediately switches off their computer screen at the press of a button. Let’s look at a few easy things that should already increase your efficiency.

First steps

To get started, you’ll want to download AutoHotkey from https://www.autohotkey.com/. You will also find the extremely helpful documentation on that site. Install the software and, hey presto, now you are ready to create scripts. Open Notepad (press the Windows key, type notepad and hit Enter) and start scripting. Don’t save your file as a .txt file but give it the ending .ahk – then you can double-click it to run it or simply stick it in your Start-up folder to automatically run when you’re starting your PC.

Defining hotkeys

AutoHotkey, as the name implies, lets you easily set hotkeys for certain actions. The syntax here is easy: first you type in the keys you want to use, then you add :: (two colons), then you add the action. Hotkeys are abbreviated – you can find a list of hotkeys in the AutoHotkey documentation. Here are some examples for hotkeys:

^    - the Ctrl key
<^>! – the Alt Gr key
!    – the Alt key

Let’s create a script that will let us use Alt Gr + F to open Firefox.

<^>!f::Run C:\Program Files (x86)\Mozilla Firefox\firefox.exe

Here we have <^>!f – the first two letters are for the Alt Gr key, f is for the f key. Run is used to tell the program to run an executable file.
C:\Program Files (x86)\Mozilla Firefox\firefox.exe is where my Firefox.exe is stored.

Can you make a script that will open your D:\2019\Invoices folder when you press Ctrl+i? (Hint: Think of opening a folder as executing it.)

Here’s the solution:

^i::Run D:\2019\Invoices

So far, all our scripts only ran across one line. If you use more than one line, you have to add return at the end, like so:

^w::
Run D:\2019\Invoices
return

Pro tip

Taskbar showing AutoHotkey icon
The AutoHotkey icon is the second from the left.

Once you run an AutoHotkey script, you will see the AutoHotkey symbol in your taskbar. Right-click it to easily open the running script to change it (Edit This Script) and then reload it once the changes have been made (Reload This Script).

Replacing text as you type

Let’s go from hotkeys to hotstrings! In order to replace text as you type, stick it between double colons, like so:

::byex::Best regards and hope to hear from you soon,{enter}Veronika

Now when you type byex (and a space), you will automatically write the given text. {enter} is used for adding a linebreak. Also, in case you’re wondering why I picked byex and not bye: There might be cases in which I’ll still want to write “bye” and I don’t want to bother with suspending my AutoHotkey script when that time comes. (Although there is a hotkey for that!)

If you’d rather your text triggered without an ending character (like space), so immediately after typing the x, use this instead:

:*:byex::

You can find out more about hotstrings in the official documentation.

Exercise: Create a script that will automatically replace l10n with Localization, t9n with translation and i18n with Internationalization! (And then can we stop using the acronyms? Thanks!)

Adding your initials with a date

Depending on what software is used for proofreading, you might want to add a date to a comment along with your initials to better track them and make them easily searchable. You should already know how to write a script that adds your initials – a date is a bit more complicated. Luckily, everything has been done before and the hotstrings documentation has just this example! I’m copying and pasting it here with my preferred keyboard shortcut: Left Alt + D.

!d::
FormatTime, CurrentDateTime,, M/d/yyyy h:mm tt
SendInput %CurrentDateTime%
return

The result is this: 2/7/2019 11:46

You can find all the necessary info about formatting dates and time here: https://www.autohotkey.com/docs/commands/FormatTime.htm

Here’s another way of doing it:

!d::
Send, %A_MM%/%A_DD%/%A_YYYY%
return

This will return the following format: 02/08/2019
Let’s adjust this a bit and add our initials!

!d::
Send, %A_YYYY%-%A_MM%-%A_DD% VH: 
return

Now we get this format: 2019-02-08 VH:

Hotkey for looking up terms in dictionaries

It’s also very easy to use AutoHotkey to open websites for you, e.g. if you want to look up a word in an online dictionary. Here’s a script that will look up a term for you in the Leo English/German dictionary. You only have to highlight the term with your mouse and use the keyboard shortcut. In this case I use Alt + L, which you can of course change if you’d rather trigger this using just one hand for that little extra bit of efficiency (so you don’t have to remove your hand from your mouse).

!l::
	Send, ^c
	Sleep 50
	Run, https://dict.leo.org/englisch-deutsch/%clipboard%
	Return

%clipboard% here will be replaced with the highlighted term, so if you want this for another dictionary, just figure out how the URL changes if you look up a word. As an example, Linguee – another English/German dictionary – will have the following URL if you enter “pasta”:

https://www.linguee.com/search?query=pasta

Search on Linguee
Searching a term on Linguee gives you the search URL.

So in order to adjust your script for Linguee, simply replace your search term with %clipboard% in the script and that’s where the highlighted term will be entered.

I’ve modified this from a script I found at lthr.io that shows you how to look up highlighted terms on Google (see below). Remember: Almost everything has been done before – so figure out what you want to do, google the problem and adjust any similar scripts to your particular needs.

!g::
	Send, ^c
	Sleep 50
	Run, http://www.google.com/search?q=%clipboard%
	Return

Keep a window always on top

Lastly, here’s a script for keeping windows always on top, say if you’re transcribing a video you want to keep looking at while you type in another window, or if you want to keep your calculator visible while working on an invoice in Excel.

!a:: Winset, Alwaysontop, , A ; ctrl + space

If you want to move the window to the background again, just use your hotkey on it again (in this case, Alt + A). This one is taken from maketecheasier.com.

Make a cheat sheet in a message box

A message box
My message box cheat sheet!

AutoHotkey can also display message boxes. By now you probably know how to write a script that will open a text file or Word file for you, so if you wanted to have a cheat sheet for terms or words you regularly look up, that would be an easy option. Just set a hotkey to open that specific file for you and the terms are literally at your fingertips.

But as I said, AutoHotkey can show message boxes, so you can stick all those terms or grammar rules you constantly look up into a message box instead. Here’s a short sample script that will show a cheat sheet for commas that throw me every time:

<!>p::MsgBox, weder ... noch `nsowohl ... als auch`nnicht nur ..., sondern auch

The hotkey for this is Alt + P, MsgBox – as you might have guessed – is the command for opening a message box, and after a comma you can simply add the text you want. The `n looks a bit funny – that’s an accent (not an apostrophe) followed by an “n” – and it is used here to start a new line. Simple as that!

Adjusting sound volume with your mouse

Last but not least, here’s one of my personal favorites, a script that lets you control the volume of your PC with the ALT key and the mouse wheel. Hold down ALT and scroll up or down to adjust the volume, or click the mouse wheel in order to mute the sound altogether:

LAlt & MButton::Send {Volume_Mute}
LAlt & WheelDown::Send {Volume_Down}
LAlt & WheelUp::Send {Volume_Up}

Obviously you can easily adjust this to your liking in whichever way you want – you can even script your volume controls to your keyboard.

Final Thoughts

I hope you now have an idea of what AutoHotkey is capable of. Ideally, the above tips and scripts are already helpful to you, but AutoHotkey can do a lot more. Even if you don’t really want to get into the details of the scripting language, the internet is full with example scripts and you can always go to a forum to see if anyone can help you find a solution for your particular problem to increase your efficiency!

Sources & Resources

Related Posts

Share this post on social media

Leave a Reply

Your email address will not be published. Required fields are marked *