1. Code
  2. Coding Fundamentals
  3. Workflow

TextExpander II: Fill Ins and Macros

Scroll to top
Read Time: 8 min


TextExpander is a Mac productivity and text expansion app. Keyboard shortcuts are expanded into longer blocks of text called snippets. If you repeatedly enter the same information, TextExpander can save you a lot of time.

In the previous article in this series, I introduced the basics of TextExpander. In this tutorial, I’ll look at using some of the more advanced features: Fill Ins and Time and Date Macros.


To follow this tutorial you will already need to be familiar with the basics of TextExpander, in particular how to create new snippets and what makes a suitable keyboard shortcut. If you aren’t, the previous tutorial is a simple introduction.

You’ll need a Mac with TextExpander installed. The app can be purchased from the Smile Software website for $44.95. There’s also a 30-day free trial.

Introducing Fill Ins

While in some cases, having the exact same information inserted every time is what you want with a snippet. In others, however, you might want to change a few small details. For example, if you use TextExpander to create canned emails, having a way to add the recipient’s name rather than a vague Dear Friend is essential. This is where fill ins come in.

There are a few different types of fill ins in TextExpander:

  • Single-line Fields are for inserting a few words into a snippet. These are the fill ins you will use most. They are perfect for recipients’ names, meeting locations and anything else with lots of options
  • Multi-line Fields are similar to single-line fields but are for inserting a longer block of text into the snippet. The main difference is how they appear in the TextExpander interface. They are best used for adding additional information to snippets such as a summary of relevant information or the next steps you plan to take
  • Popup Menus are for inserting one of a few different options selected using a dropdown menu. Popup menus should be used when there are a limited number of possible options. They advantage they have over the field fill ins is that you can include longer sentences without having to type anything
  • Optional Sections are blocks of text that can be added or removed by selecting a checkbox. They are similar in some respects to pop up menus but only allow for a single option. If there is a section that is normally, but not always, included in a snippet then an optional section is a good way to simplify your workflow
  • The Clipboard fill in adds the contents of the system clipboard to the snippet. Using the email example, you can copy the reason they emailed you to the clipboard and have it inserted at a relevant point in your reply

Tip: The Show At Top fill in isn’t really a fill in, it tells TextExpander to add all the fill ins in a snippet to the top of the fill in dialogue.

Introducing Time and Date Macros

Time and Date Macros, like fill ins, are used in TextExpander to add dynamic information to snippets. In this case, to do with the current, or any other, time and date.

With TextExpander, using the provided placeholders, you can add the current time and date in pretty much any format you’d like, from a simple date to something that includes the day name, month, year and time accurate to the nearest second.

While adding the current date has its place, sometimes you need to add details about a date in the past or future. For that, TextExpander has Date/Time Math. You can have the app add or subtract any number of seconds, minutes, hours, days, months or years to the current time. 

This is really useful when you want to add something like Please let me know by Thursday next, 23 July to your snippets.

Cursor Control and Key Presses

While other apps like Keyboard Maestro which I’ve written extensively about are better suited to automating a Mac, TextExpander has some simple features that are useful for working with snippets.

First, with TextExpander you can control the cursor position within snippets. There are two main options: you can either instruct TextExpander to place the cursor position in a particular place after the snippet has expanded or you can simulate presses on the Arrow Keys and have the cursor move left, right, up, or down.

Second, TextExpander can also trigger certain key presses: Enter, Esc, Return and Tab.

These features are useful if you’re using TextExpander to autofill the contents of multiple fields, for example, the subject and body of an email. The snippet can add the subject to the email and then, using the Tab key, jump to the body section of the email and add the rest of the content.

Creating a Complex Snippet

Now to tie everything together and develop a complex snippet. For this tutorial, I’m going to create a snippet that autofills an email telling people about my Tuts+ tutorials. 

The important thing here isn’t exactly what my snippet does but how it does it. Feel free to modify it, or add content that is far more relevant to you as you work through this tutorial.

Create a new snippet and assign it an appropriate abbreviation and label. I’m using xwork and calling it Previous Work Email.

subject linesubject linesubject line
Adding the subject line to my email snippet.

Add the subject of the email to the snippet field. Something like Here’s My Previous Work is perfect. Then, from the Insert dropdown menu (it has the I-Bar icon) select Key > Tab

This inserts a Tab key press after the subject which in Airmail 2, the email app, jumps from the subject input to the email body input.

Then add the salutation. Obviously, you want to address the recipient by name so select a single-line field from the Fill Ins section of the Insert dropdown. 

To make the snippet easier to use, assign it an appropriate Field Name like Recipient. You can also assign a default value, I’ve used dude.

first fill in fieldfirst fill in fieldfirst fill in field
Adding a single-line field fill in for the recipient's name.

Tip: Double-click on the placeholder text to bring back up the fill in creation dialogue box.

For the main body of the email I want to add the content from my Previous Tuts snippet from the last tutorial. I could retype the information but with TextExpander you can nest snippets. 

This is great as it means if I update my list of sample articles in the main snippet, it’s automatically updated in every other snippet that uses it. To nest a snippet, select the one you want from the Insert > Snippet menu.

In order to use some date/time maths, I'll assume I’m asking whoever I’m emailing for their opinion on my work and I need their feedback within the next week. I want the sentence to read I’d love to hear what you think of them; if possible, by [Day Name] next, [Month] [Date].

To do this, type in the introductory words then, before adding the day name, select Date/Time Math > Add Day(s). In order to add a week instead of a single day, change the 1 to a 7 in the place holder. 

Add the rest of the date place holders and other text. The final macro should say something like I’d love to hear what you think of them; If possible, by %@+7D%A next, %B %e.

Tip: TextExpander works with a single date at once. If you add a week then every time you use the date function it will work with that future date. To reset it to a different date, you need to use Date/Time maths.

It’s always a good idea with email snippets to have a place to add anything else you want to say. Often you’ll want to add a few lines of a more personalised message to tie everything together. I tend to do this at the end of the email’s body.

To do the same, add a multi-line field fill in towards the end of your email. Again, give it an appropriate name and, if it needs one, default value.

closing pop up menuclosing pop up menuclosing pop up menu
The closing pop up with a choice of three salutations.

The email’s body is now finished, all that remains is to sign off. To mix things up, I’m going to add a popup menu to select a closing salutation. Add a Popup Menu fill in. Give it an appropriate name and for each option you want, add the relevant text. I’ve used Cheers, Thanks and All the best.

If you add the same fill in field twice, it will use the same content in both places. To fully personalise the email, add the recipient’s name field again so that the closing reads Cheers [Recipient].

using the fill inusing the fill inusing the fill in
Using the finished snippet.

With all that done, the snippet, if you’ve followed along exactly, should read something similar to:

Here’s My Previous Work%key:tab% 

Hey %filltext:name=Recipient:default=dude%,


I’d love to hear what you think of them; If possible, by %@+7D%A next, %B %e.

%fillarea:name=Personalised Message%

%fillpopup:name=Closing:default=Cheers:Thanks:All the best% %filltext:name=Recipient%,



In this tutorial I’ve moved past the basics and looked at developing complex and dynamic snippets in TextExpander. Fill ins and macros are amongst the most useful features of the apps. Many snippets you create will make use of them.

In the next tutorial, I’ll look at using scripting languages with TextExpander.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.