6 Scripts for TextExpander for macOS using JavaScript for Automation (JSA)

Free Scripts

TextExpander for macOS has been scriptable since version 3.3, released in 2011. Scripting allows you to extend TextExpander’s capabilities in any way you want, and in ways we might not have thought of. It also allows us (and you) to play around with a feature, such as export or search & replace, before we commit to adding it to the product.

We’ve compiled a set of several scripts we think can be useful, and we’ve published them on GitHub.

Here’s the GitHub repository.

If you are familiar with GitHub, clone away. Pull requests welcome.

If you’re not familiar with GitHub, it’s a place where we can host code publicly such that others can ask us to update it with their changes. If you just want a specific script, you can click the GitHub repository link below, click on a script, then click Download, and it will download as you expect. Double-click the downloaded file to open it in Script Editor. Click Run to set the script in motion.

Here are descriptions of the scripts and what they do:

Change Case Behavior

Allows the user to select groups, then to select desired case sensitivity behavior for those groups, then applies those changes.

Change to Plain Text

Changes all snippets in a user-selected list of groups to plain text.

Also, a good example of performing a specific behavior on a set of user-selected groups.

Export Groups to CSV Files

Exports user-selected groups to user-selected destination folder in CSV format.

Export Groups to TextExpander Files

Export user-selected groups to user-selected destination folder in .textexpander format.

Search and Replace

Search and replace plain text content in user-selected set of groups.

Strip Non-Breaking Spaces

Strips non-breaking spaces from shell script snippets in user-selected groups.

Apple released JavaScript for Automation (JSA) in macOS 10.10. Apple’s documentation is quite minimal. Here’s a tutorial from the great folks at Envato Tuts+, which offers a good starting point if you’re interested in learning more.