Using TextExpander with Drafts

iu

IMPORTANT: TextExpander is phasing out support for direct integration with other apps. Learn more.

Smile Software’s TextExpander is a text expansion utility that allows quick conversion of short, easy to type abbreviations into larger snippets or blocks of text. It is a powerful and convenient tool to boost your productivity.

TextExpander is available on many platforms. On Mac it works everywhere because of the system level integration available on the platform. On iOS, Smile provides an integration SDK. Drafts supports this integration, but it requires a couple of extra steps to get setup and running.

TextExpander on iOS also provides a custom keyboard which can be used in any app. This article is specifically about direct integration with Drafts, which allows TextExpander snippets to be expanded when using other keyboards.

TextExpander with Drafts on Mac

No special steps are needed to use TextExpander with the Mac version of Drafts. TextExpander works system on macOS. Note that expansion in actions as described below is also an iOS-only feature.

Enabling TextExpander (iOS only)

To enable TextExpander support in Drafts on iOS:

  • Make sure TextExpander is installed on your system and you have run it at least once to configure your TextExpander account, if necessary.
  • Open Settings (Gear icon in lower right).
  • Scroll down to the “Extensions” section and tap “TextExpander”.
  • Turn on “Enable Expansion”. If enabled, TextExpander will attempt to expand your abbreviations while typing in Drafts’ editor.
  • Optionally, turn on “Expand in Action Templates”. If enabled, when running actions, TextExpander snippets in action step templates wrapped in << >> will be expanded (see details below).
  • Tap “Refresh Snippets”. This will trigger TextExpander to launch, and return to Drafts, updating your current snippet library for use in Drafts.

That’s it, you are ready to go! Return to you the Drafts editor, and type one of your snippet abbreviations and it will be quickly expanded.

Refreshing Snippets (iOS only)

Due to the way apps are sandboxed for security in iOS, it is not possible automatically receive updates to your snippets from TextExpander. When you make changes to your snippet library in TextExpander, you will need to “refresh snippets” in Drafts to pick up these changes.

This can be done by visiting the settings screen shown above, and tapping “Refresh Snippets”. A refresh can also be triggered by a URL in Drafts. We provide an example Refresh TextExpander Snippets Drafts action which can be installed to more easily access this refresh, or you can configure your favorite launcher app or Shortcuts to open the below URL to trigger a refresh:

drafts://refresh_text_expander

Expanding Snippets in Action Templates (iOS only)

Note: “fill-in” snippets are not supported in action expansion, and this expansion is not available when processing templates in script.

As mentioned above, TextExpander snippets can be dynamically evaluated in action templates by including one of your abbreviations, wrapped in << >>. For example, if you have an abbreviations ..e in TextExpander which expands to your email address, in an action template you can include My email is <<..e>> and when the action is run the snippet will be expanded.

This is most useful for insertion of time-sensitive snippets - for example dates - that you want to be evaluated when an action is run, not when you are typing the draft. For more details about using action templates, see our introductory article on using templates.

Be sure you have turned on “Expand in Action Templates” in the TextExpander settings page to enable this feature.

3 Likes

I use iOS’s built-in text replacement. What advantage does TextExpander offer?

From this iMore article:

TextExpander by Smile Software is what I use. It’s far more powerful than the built-in tool. TextExpander can expand far more than just text. As you will see in some of my examples, it can insert the contents of your clipboard, run AppleScript (on the Mac), use form data and more. It can be used on Windows 7 or higher, unlike Apple’s solution. Additionally, TextExpander snippets can be used on iOS. It comes with its own third-party keyboard, but many text editing apps like Editorial, Drafts and 1Writer offer native support for your TextExpander library without the need to use Smile’s keyboard.

If you just have a look at any review article or video, you’ll very quickly get a feel for what advantages it offer.

1 Like

I see. It’s changed a lot since I used it a few years ago. But the price is high and I wouldn’t use all the features. Thanks for the help.

1 Like

I have been using the iOS built-in keyboard shortcuts for a while and have a whole bunch of the text shortcuts set up. I also purchased TextExpander a long time ago, and while I see that it is indeed more powerful, I haven’t ever been able to get myself to really sit down and just set the darn thing up.
I write about Symbology, Linguistics, and Psychology, and am working on a massive project showing how language affects thinking (Sapir-Whorf Hypothesis / Linguistic Relativity etc.) One of the things I like about the iOS text replacement is the ability to use it across symbol sets so I can stay in the ENG-US keyboard, type a few characters and have the replacement work without having to switch keyboards. I didn’t realize Drafts had support for Text Expander that didn’t require use of their keyboard.

I am only able to use fill-in snippets in Drafts if I type the via the keyboard. If I trigger them via expansion in action (keyboard or normal) action than fill-in snippets won’t launch TextExpander to fill-in the fill-ins. Is that the expacted behaviour?

1 Like

Well, that’s a typo. That should read “not supported”. Just fixed the text, sorry for the confusion. It’s a limitation of the TextExpander SDK and integration.

That’s a pity. I just read that and I was hoping that it is possible now. I haven’t tried to use fill-in snippets in actions. Maybe it will be supported by TextExpander in the future because it would make their snippet engine more powerful in my opinion.

It is unlikely fill-in snippets could ever work well with the programatic expansion of snippets on iOS, for a lot of technical reasons…I wouldn’t expect any changes there.

In case it is of any use, here’s an example of the workaround I use and it’s been pretty solid for me in the couple of cases I’ve used it.

The example uses a fill-in based snippet with a abbreviation of fillinexample. For this example it looks like this.

In the first step of the Drafts action, a URL call is made to TextExpander using the abbreviation. This populates the callback result which I then use the template tag for in the text insertion.

When the action is run, you get pushed out to TextExpander, enter text in the fill-in field, tap done, get returned to Drafts, and the text is then inserted.

E.g. Entering foo in the field resulted in this output in Drafts.

3 Likes