Secret TextExpander Codes and How to Use Them

Did you know that TextExpander has secret codes? Well, before TextExpander 7.0, they weren’t so secret. You could manually insert shortcodes for features like Fill-in Fields, optional sections, and cursor movement into any Snippet.

We’ve since hidden those codes behind a graphical interface… for most Snippets. However, they still work in script Snippets, like AppleScript, JavaScript, and Shell Script.

And here’s a trick: You can insert any of these codes into one of those Snippet types, change the content type to Plain Text or Rich Text, and they will appear as their graphical elements.

Clipboard-20250605-145208-398

Why is this a good trick to know? In short, speed:

  • If you know the codes, you can quickly type them out instead of clicking through menus.
  • You can programmatically create long Popup Menus and Optional Sections. A couple of examples:

Recently, I posted about using ChatGPT to create Optional Sections using these codes.

Without further ado, here are those special codes:

Fill-in Fields

  • %filltext:name=<field name>% = Single Line fill-in field
  • %fillarea:name=<area name>% = Multi Line fill-in field
  • %fillpopup:[default=]<value>:<value>:<value>[…]% = Popup Menu
  • %fillpart%<content of optional section>%fillpartend% = Optional Section

Cursor Movement

  • %> = cursor right
  • %< = cursor left
  • %^ = cursor up
  • %v = (letter v) cursor down

Other

  • %clipboard = Insert clipboard text contents here.
  • %| = Position the cursor at that location once a Snippet is expanded.
  • %\\ = Select a range of text upon Snippet expansion. The text must be surrounded by %| at the beginning and %\ at the end.
  • %% = Expand a single percent character (“escape” the percent sign from being treated as a macro code).
  • %Snippet:<Snippet abbreviation>% = Nest the specified Snippet’s expansion within this one.

For examples, see these posts:

4 Likes

This shouldn’t need to be a “trick.” Your article gives no reason as to why they were hidden in the first place. It would be much better, if, say, the snippet syntax was recognised and changed colour – for each recognised syntax term – as you typed in Plain Text or Rich Text. Upon saving, it just gets parsed/replaced with the lozenges then appearing.

1 Like

That decision was made before I arrived, and most of that team has moved on, so it’s as much of a mystery to me as it is to you. My assumptions as to why the change was made:

  • Raw codes were confusing less-technical users.
  • Almost no one used the feature.
  • You can still use the codes with the more-advanced scripting content types.

Again, these are merely guesses.

1 Like

I mean, if only TextExpander had access to developers familiar with text replacement, hey?:wink:

I think your reasons are all sound assertions. Doesn’t mean they are right, though. The script dance does work, but is clunky at best.

I’d say these are probably reasonable guesses/assumptions @josh👍
As a product owner you’d want as many different users to be able to use what is easiest for them and their use case. UX design principles 101 right?

1 Like