

Second, it uses a random generator to choose one of them and assign it to the variable “ selectedGreeting. First, it defines a list of greetings to choose from. You don’t have to understand all the details of the script to use it, but it basically has four steps. Every time you call the snippet it will expand into a greeting that will be randomly chosen from a set of predefined phrases to close your email. You can tell TextExpander to treat it as a script by clicking on the drop-down list “Content,” which reveals the options “Plain Text” (default), “Formatted Text, Pictures,” as well “AppleScript,” “Shell Script” and, since version 5, also “JavaScript.”įirst simple example: say goodbye in random waysĪn easy snippet to start with can be found on the webpage of Smile Software, the home of TextExpander.
#TEXTEXPANDER SNIPPET CODE#
If you don’t do that, it will simply produce the code lines without doing actually what you want. The first step is to tell TextExpander that your snippet is not simple text, but should be interpreted as a script.
#TEXTEXPANDER SNIPPET HOW TO#
How to tell TextExpander to start a script Because of this, it’s very easy to fall into the trap of using TextExpander for things that could have been implemented more easily with other tools like Apple Services, Alfred 2, KeyboardMaestro or others. While this sounds obvious, there are almost no limits to what you can do with scripts. So before you start coding a complex script, I suggest that you have a look at these default functionalities of TextExpander and see if you can implement a solution with them.Īnother point to consider is that TextExpander is primarily about expanding text.

TextExpander is an incredibly useful tool that expands user-defined text abbreviations (called snippets) into more complex pieces of text. He is a Lecturer (Assistant Professor) in Robotics at the University of Bristol (UK), a father of three little boys, and a productivity geek. He shares his tips and tricks on how to work smart and be remarkable from his view point as an academic on his blog and you can find him on Twitter.
