Kernic

Just my toughts.

Using the Right Characters with AutoHotkey

Using the right characters with AutoHotkey - a guide for more efficient typing. How to automate special characters and shortcuts. A tool for anyone who writes a lot.

πŸ”Š Read out blogpost
πŸ“₯ Download MP3

Some characters are nearly extinct because they don’t even appear on the standard German keyboard layout. Besides “German quotation marks,” this includes the narrow and regular non-breaking spaces. What do you need those for?

Actually, the regular and narrow non-breaking spaces are the official separators for thousands (the narrow one) and as a space before a unit (the regular one), at least according to ISO 80000. So, one thousand two hundred kilograms is actually written as 1β€―000Β kg. Between the 1 and the 000 is the narrow non-breaking space, and between 1,000 and kg is the regular one. And you can see the quotation marks above. Apart from Word, these are not automatically replaced anywhere, and there are no keys for them on the keyboard. Consequently, we now almost exclusively see “these kinds of quotation marks” instead of β€žthese.β€œ

Now, there are several ways to type these characters anyway. Most of them, however, are cumbersome. For example, you could enter the characters using their ALT code with ALT and the number combination on the numpad. But for that, you have to remember the codes and type them in awkwardly. Not exactly pleasant for your writing flow. Another option would be to customize the keyboard layout. With the NeoLayout, the non-breaking spaces are on layer 5 and layer 6, and the German quotation marks are at least on layer 2. But for that, you either have to learn a completely new layout without a matching keyboard or use NeoQWERTZ, also without matching keyboards.

I just never warmed up to Neo, and ALT codes only work with a numpad. Thanks to my clan, I stumbled upon AutoHotkey in a different context. It’s a small program that allows you to run complex scripts at the touch of a button. In the clan, for example, there’s a script that automates fishing in Destiny 2. But it can also be used to replace keyboard inputs or create new key combinations. And that’s exactly what I used it for, creating a script for the spaces, quotation marks, and the ß. I still want to use the latter when writing, but since I now work in Switzerland, everyone there gets confused by it.

Of course, you can do much more with AutoHotkey. As I said, it’s even possible to automate processes in games. My fishing script automatically detects when a character appears on screen in the game and triggers a sequence of different keystrokes. Feel free to leave me a comment about what you use or would use AutoHotkey for.

Setting Up AutoHotkey

A quick guide for inspiration

Setting up AutoHotkey is actually surprisingly easy, but I’ll describe it here in a few short steps.

  1. Download and install AutoHotkey v2.0:
    https://www.autohotkey.com/
  2. In the program window that appears after installation, click New script, give it a name under Untitled, then click Edit. You can also change the file path if needed.
  3. The first time you start, you have to select a text editor. Either choose the editor from the list, or select the executable file (.exe) of another editor via Browse. I recommend Notepad++.
  4. In the editor, you then enter the actual script(s), which you can find below this guide, and save. You can pack the desired parts into one file and simply leave out all the others.
  5. Afterwards, you can navigate to the AutoHotkey folder in your Documents using the File Explorer (WIN+E) and start the script with a double-click.
  6. If an icon with an H on a green background appears in the taskbar next to the clock, the script has started and you can happily start typing. Have fun!
; CTRL+Space creates a narrow non-breaking space
^Space::
Send, % Chr(8239)
return
; ALT+Space creates a non-breaking space
!Space::
Send, % Chr(160)
return
; CTRL+2 creates a lower German quotation mark β€ž
^2::
Send, % Chr(8222)
return
; ALT+2 creates an upper German quotation mark β€œ
!2::
Send, % Chr(8220)
return
; Replace ß with ss for Swiss spelling
ß::
Send, ss
Return

For those of you who are interested, a brief explanation. Semicolons (β€―;β€―) are used to insert comments. Everything to the right of it is a comment and is not executed.

Before the two colons are the conditions. ^ here stands for CTRL, so ^2 means that the script waits for CTRL and the 2 key to be pressed. After the colons comes the action that is triggered. In this case, Send, % Chr(8222), which sends the German quotation mark. Return then simply ends the script.