TextExpander macros are special placeholders you can include in snippets to automate actions. For example, pressing keys, inserting dynamic content (dates/times), or moving the cursor.
In other words, macros make your snippets do more than just insert static text–they perform tasks for you.
This can dramatically speed up repetitive workflows and reduce errors. As one TextExpander trainer put it:
“These [macros] can allow you to develop workflow snippets that help make your workday easier. Who doesn’t want something to take care of those repetitive tasks for you? That’s what macros can do.”
There are three primary categories of TextExpander macros we’ll cover: Keyboard macros, Date/Time macros (with math), and Cursor macros. Each type serves a different purpose:
- Keyboard macros simulate key presses (for example, “Enter” or “Tab” keys) or insert other snippets/clipboard content.
- Date/Time macros automatically insert the current date or time (and can do date math like “today + 7 days”).
- Cursor macros reposition your cursor or select text after the snippet expands.
Below, we’ll dive into each type with step-by-step guidance and practical examples from a TextExpander training session.
Keyboard macros (simulating keystrokes)
Keyboard macros let your snippet press keys for you. Instead of manually hitting “Enter,” “Tab,” etc., your snippet can do it automatically during expansion.
Use keyboard macros whenever your snippet needs to mimic typing a key to achieve something. Typical scenarios include: moving to a new line or form field, advancing through form fields, submitting a form, or pasting dynamic content.
For example, you might have a snippet that fills out two fields in a form – typing some text, then hitting Tab to jump to the next field, then typing more. Or you might want a snippet that types a message and then presses Enter to send it. Automating these keystrokes saves time and ensures consistency.
How to create a keyboard macro:
- Open or create a snippet in the TextExpander editor where you want to add the macro.
- Place the cursor at the point in your snippet content where the keystroke should occur (e.g. at the end of a line if you want an Enter key press after that line).
- Insert the macro: Click the Keyboard button on the editor’s toolbar (the icon that looks like a keyboard) and choose the key you want to insert. For example, select Enter (on Mac this may be labeled “Return”) or Tab from the dropdown. TextExpander will insert a visible placeholder for that macro in your snippet.
- Add any additional text or macros needed after the key press. You can insert multiple key macros in one snippet if needed. For instance, you might add text, then an Enter macro, then more text, then a Tab macro, and so on.
- Save the snippet and test it out by typing its abbreviation. The snippet should expand, typing your content and automatically performing the key presses where you inserted the macros.
Two other powerful options under the Keyboard macro menu are the Clipboard macro and Insert Snippet macro.
The Clipboard macro will insert whatever text is currently copied to your clipboard at the moment of expansion. This is great for scenarios where you copy something (like a name or an ID) and want your snippet to paste it automatically into the output. For example, a support agent could copy a customer’s name and trigger a snippet that says “Hello <clipboard>,” inserting the copied name into the greeting.
The Insert Snippet macro lets you nest one snippet inside another – a favorite feature for building modular snippets. For instance, you might maintain a snippet for your email signature and insert it into multiple other snippets (like templates or replies). That way, if your signature changes, you update one snippet and all the others update automatically.
While these are slightly beyond basic keystrokes, they are implemented through the same Keyboard menu and can significantly boost your snippet’s flexibility.
Date and time macros (with math)
In TextExpander’s editor, the Date/Time button (often shown as a calendar or clock icon) allows you to choose from various date and time formats (e.g. full date, month abbreviation, 24-hour time, etc.).
These macros are great for timestamping notes, inserting today’s date in letters, or any situation where you need up-to-the-minute date/time info.
The “with math” part means you can also add or subtract time from the current date/time. TextExpander provides a Math macro (calculator icon) that you can use to offset a date/time – for example, to get a date 7 days in the future or to subtract 1 year.
Common use cases include: Adding today’s date or current time automatically (so you don’t have to look it up or format it), stamping an email or log with the current date/time, or calculating future/past dates (like due dates, follow-up reminders, expiration dates, etc.).
The key benefits are accuracy and speed—you’ll never mistype the date or have to calculate “what date is next Thursday?” manually. Let TextExpander do the math for you.
How to create a date/time macro:
- Insert a date or time macro: In your snippet, click the Date/Time button on the toolbar. Choose the format you want (for example, “Month/Day/Year” or “Day of Week, Date” or a time format). A placeholder will appear in your snippet indicating the date/time insertion. You can insert multiple date/time macros if needed (for instance, one for today’s date and another for the current time).
- (Optional) Add math adjustments: If you need a date or time other than the current moment, use the Math (calculator) button before the date/time macro. Click the Math button and select an operation (Add or Subtract) and the unit (days, weeks, years, hours, minutes, etc.), then enter the number. For example, to get tomorrow’s date, choose Add “1 day.” This Math macro must be placed immediately in front of the date macro it should modify. (TextExpander will show the math macro as a tiny calculator icon in front of the date placeholder in your snippet.) You can stack multiple adjustments as well.
- Save and test: Expand the snippet to ensure it outputs the date/time you expect. If the math isn’t applied, double-check that the math macro comes before the date macro. Also remember that if you use multiple date macros in one snippet and only want to adjust one of them, you may need to reset the date adjustment before the second date. (There’s a “Reset Date Adjustment” option under the Math button for this purpose.)
When using date math, always insert the math macro before the date/time macro it affects. If you put the math after, it won’t work.
Also, if you chain several date macros with math in one snippet, use the “Reset Date Adjustment” macro to clear any carry-over before starting a new calculation. In most simple cases you won’t need reset, but it’s good to know for complex snippets.
Cursor macros (positioning the cursor)
Cursor macros let you control where the text cursor goes after your snippet expands, or even select a portion of the expanded text. They essentially simulate moving the cursor with arrow keys or the mouse.
In the snippet editor, the Cursor button (often an icon with a pointer or arrow keys) provides options like Position Cursor Here (to set the insertion point), Select to Here (to select text from the cursor to that point), and individual arrow key presses (Up, Down, Left, Right).
There are also a few advanced options related to “delimiters” (expansion triggers), which we’ll set aside for now. The core idea is that cursor macros give you control over where typing should resume after the snippet runs and what text (if any) should be highlighted. For example, if you have a form letter snippet, you might want the cursor to end up at a blank greeting line so you can type the recipient’s name.
How to create a cursor macro:
- Decide where the cursor should go: In your snippet content, click at the spot after which you want the cursor to end up. For instance, if you want the cursor to come back to a certain point to fill in a name, place the cursor at that insertion point. Then click the Cursor button and choose Position Cursor Here. This will insert a placeholder (often represented by a vertical bar | in the snippet editor) at that spot. When the snippet expands, the cursor will jump back to this position.
- (Optional) Set a selection range: If you want a section of text to be highlighted upon expansion (for example, to draw attention to it or to prompt the user to replace it), you can use Select to Here. To do this, you need two things: a starting point and an ending point for the selection. Typically, you would first insert a Position Cursor Here at the beginning of the text you want highlighted (as above), then insert a Select to Here at the end of the text to be selected. Whatever lies between those two macro placeholders will be selected when the snippet expands. (In practice, TextExpander will place the cursor at the start point, and then select everything from that point up to the “Select to Here” marker.)
- Use arrow key macros if needed: If you prefer to move the cursor relative to its current position, you can insert arrow key macros. For example, adding a “Left Arrow” macro will move the cursor one character to the left when the snippet expands. Arrow macros can be combined (e.g. four Left Arrow macros will move left four characters). In most cases, Position Cursor is more direct, but arrow keys are handy for navigating fields or menus. As the trainer noted, “the arrow keys really just simulate you pressing the four arrow keys on your keyboard… It can be used to navigate fields, …buttons inside of an application… anywhere that you could use your keyboard arrows to accomplish something, you can turn that into a macro”file-phwn7pya52any5ncg7jhqk.
- Save and test: Try expanding your snippet. If you used Position Cursor Here, you should see that after the snippet’s text appears, your cursor is sitting at the placeholder spot ready to type. If you used a selection, that text should be highlighted. This might feel like the snippet “jumped backwards” to select text – that’s exactly what it’s doing. You can now type to replace the highlighted text or apply formatting to it.
Cursor positioning is also extremely useful for multi-field form snippets. For example, say you have a snippet that fills out an entire form with several fields. You can include Tab key macros to navigate between fields, and if one field needs manual input, use Position Cursor Here to stop there. The snippet will expand and leave the cursor at that blank field for you to fill in. This saves you from grabbing the mouse or pressing additional keys to jump to that spot.
The guiding principle is: If you know you’ll need to click or move after expanding a snippet, consider building that movement into the snippet with a cursor macro.
Macros video demonstration
To further demonstrate how these macros can be leveraged, three of our teammates have created the following video overview.
Not able to play the video? Click here to watch the video