TextExpander
 

Help: Advanced Snippet Functions: Macros

What is a Macro?

In the context of TextExpander, a macro is a variable, or placeholder, for some other piece of information you want to insert in your snippet, such as today's date or something you copied to your clipboard. When a snippet that contains a macro is expanded, that macro is replaced by the information you specified.

TextExpander provides several different macro options to choose from. These macros are accessible in the TextExpander window through the row of buttons in the editing bar at the top of the snippet editor.

Date / Time Snippets

Insert the current date or time with a snippet. Or use date/time math to add a past or future date/time, for example the date five days from now. (See Date, Time, and Math Macros).

Clipboard

When you copy something it is stored on the computer clipboard for you to paste it. Have whatever you recently copied to your clipboard included as part of your snippet upon expansion. For example, say you want to customize just one portion of a form letter.

  1. Create a snippet with content:
    • Hello (clipboard),

      It was a pleasure meeting you! Thank you for coming.

      Cheers,

      Ann

  2. Copy something to the clipboard, Command + C (Mac) or Control + C (Windows), in this case "Bob".
  3. Type the snippet abbreviation. It will expand:
    • Hello Bob,

      It was a pleasure meeting you! Thank you for coming.

      Cheers,

      Ann

Key Presses

Insert the equivalent of the press of a key into a snippet. Available key options are Enter, Escape, Return and Tab. This is useful for web forms where a single snippet can fill in a field, tab to the next field, then submit the form with the Enter key. Also, useful in emails where you want one snippet to fill in the Subject line then tab to the email body and fill it in. That snippet might look like this:

email example

Cursor Position

Position Cursor Here:
Specify where in the snippet content you want the cursor to appear once expanded. The cursor appears at the end of the snippet by default.

Select To Here:
In combination with (Position Cursor Here), this specifies a range of text to be selected within the snippet after expansion.

Cursor Movement

    Cursor right

    Cursor left

    Cursor up

    Cursor down

In cases where your editor might automatically add indenting to your snippet, or for other reasons, you can specify up, down, left or right arrow keystrokes to occur between parts of the expansion, or if placed at the end of the text, these arrow keystrokes can adjust the cursor position relative to the end of the snippet after the expansion. They cannot be used effectively in combination with Position Cursor Here or Select To Here.

Delimiter Overrides

These delimiter modifiers override the Preferences > Expansion > Expand abbreviations setting treatment of the delimiter character.

Nested Snippets

Nest a snippet within another snippet. For example, you might want to use your telephone number snippet in your email signature snippet, or your email signature snippet inside multiple snippets you have for emails. If your telephone number changes, you only need to update one snippet. Here is a telephone number snippet (ttel) nested in an email signature snippet (ssig):

    ssig =

      Ciao,

      Lisa

      ---

      Lisa Newton

      Acme, Inc.

      lisa@acme.com

      (ttel)

    The snippet will expand to this:

      Ciao,

      Lisa

      ---

      Lisa Newton

      Acme, Inc.

      lisa@acme.com

      1-408-996-1010

Nested snippets also work with JavaScript, AppleScript, Shell Script Snippets.

Fill-in Fields

Insert custom fill-in-the-blank fields into your snippets that can be filled in while expanding the snippet; useful for form letters. For example "Dear ____, Thank you for the ____." (See Creating and Using Fill-in Fields).


 

Smile logo

© 2006-2019 SmileOnMyMac, LLC, dba Smile. All rights reserved.
TextExpander is a registered trademark, Smile and the Smile logo are trademarks of SmileOnMyMac, LLC, dba Smile.