⟳ Automation

Text expanders: type less with abbreviations and snippets

Text expanders, AutoHotkey, espanso, macOS text replacements and Word Quick Parts to insert signatures, standard replies and dates in seconds.

How many times a day do you type your email address, your full signature, the office bank details, the same answer to a frequently asked question? Each repetition takes a few seconds, but over weeks and months it adds up considerably, and every retyping is a chance for a typo. Text expanders are the simplest form of office automation: you type an abbreviation and the program replaces it with the full text, in any application.

How an expander works

An expander runs in the background and watches what you type. When it recognises a defined sequence, for example ;sig, it deletes it and inserts the associated text in its place. It works in the email client, the browser, the management system, web forms: anywhere you can type.

Choosing the abbreviation matters more than it seems. It must be a sequence you would never type by accident. That is why many people start all abbreviations with a rarely used character, such as a semicolon or a colon: ;addr for the address, ;iban for bank details, ;thx for a thank-you phrase. Abbreviations without a prefix, such as addr, would end up expanding in the middle of words like "address".

The options available

Tool System Features
Text replacements macOS, iOS Built in, syncs across Apple devices
AutoHotkey Windows Free, very flexible, written in text files
espanso Windows, macOS, Linux Open source, configured in YAML files
Quick Parts and AutoText Word, Outlook Formatted text, even with tables and images
AutoCorrect Word, Writer Short replacements as you type

macOS: already included

Under System Settings > Keyboard > Text Replacements you add pairs of abbreviation and phrase. They are handy and sync to iPhone and iPad on the same account, but they handle only plain single-line text and don't support dynamic dates.

AutoHotkey on Windows

AutoHotkey is an automation language for Windows. Replacements are called "hotstrings" and are written in a text file with the .ahk extension:

::;addr::12 Via Garibaldi, 20121 Milan
::;thx::Thank you for your attention; I remain at your disposal for any clarification.

Double-clicking the file starts the script, which stays active in the notification area. To have it always available, put a shortcut in the startup folder, which opens when you type shell:startup in the Run window. AutoHotkey can do much more, such as remapping keys or automating windows, but hotstrings are enough to get started.

espanso: cross-platform

espanso is an open-source expander that works the same way on Windows, macOS and Linux. Its configuration is a YAML file:

matches:
  - trigger: ";sig"
    replace: "Mario Rossi\nAccounts office\nTel. 02 1234567"

  - trigger: ";today"
    replace: "{{date}}"
    vars:
      - name: date
        type: date
        params:
          format: "%d/%m/%Y"

The second example inserts today's date in day/month/year format: typing ;today produces the current date written in digits. It is useful for reference numbers, notes and file names. The configuration file is plain text: you can keep it in a synced folder and use the same one on several computers.

Word and Outlook: formatted text

When you need a formatted block, such as a signature with a logo, a contract paragraph with bold text or a table of terms, the best solutions are inside Office. In Word and Outlook you select the content and choose Insert > Quick Parts > Save Selection to Quick Part Gallery. Word's AutoText also lets you type the beginning of an entry's name and press F3 to insert it.

What is worth turning into an abbreviation

A good way to choose: for one week, note down every text you type more than twice. The list usually includes:

  • personal and office contact details, tax code and VAT number;
  • opening and closing phrases for emails;
  • answers to frequent questions from clients and colleagues;
  • recurring instructions, such as the steps for logging into a portal;
  • standard sentences in minutes or technical reports.

In my work I also keep a few abbreviations for technical snippets, such as script headers or long commands I often use in a terminal.

Beware of sensitive data

An expander stores its texts in files on the computer, often in plain text. That is acceptable for an address or a company bank account number, which are meant to be shared anyway. It is not acceptable for passwords, access codes or third parties' personal data: for credentials there is the password manager, which fills them in securely. If the configuration file is synced to the cloud, this applies all the more.

In short

  • Expanders replace an abbreviation with full text in any program.
  • Use a prefix such as ; to avoid accidental expansions.
  • macOS has built-in replacements; on Windows AutoHotkey and espanso are excellent choices.
  • For formatted text use Quick Parts and AutoText in Word and Outlook.
  • Never store passwords or confidential data in an expander.
MM
Marco Marzaduri

Marco Marzaduri works in cybersecurity, digital forensics and web development. A computer science graduate, he combines rigorous technical analysis with attention to the people who use technology.

Read also