Text expansion apps are a great way to save time when you find yourself typing the same information repeatedly, but they can do much more than that. One our favorites is TextExpander on Mac, and it’s a powerful tool once you learn how to use it.
Thanh recently wrote on our site about the basic features of TextExpander and how he uses it on a daily basis, and in this post I want to dive in a little deeper by showing you how you can use the different macro types that are available in TextExpander to create your own (and more complex) "snippets."
This post originally appeared on Asian Efficiency.
In TextExpander terms, a "snippet" is what is displayed when you type the assigned TextExpander abbreviation. For example, an abbreviation like "tyvm" might expand to the the snippet "thank you very much." I use this a lot for quotes. For example, I have an abbreviation "xplan" that expands to the snippet of one of my favorite quotes, "those who fail to plan, plan to fail." So at its core, TextExpander is exactly what it sounds like—a program that expands text. And if this was the only way you ever used TextExpander, the app would still be well worth the $35 list price because it would still save you a ton of time.
However, many times the text you end up typing repeatedly has variable or optional content. This is where the macros we’re going to discuss in this post can really come in handy.
Introduction to Macros
There are several different types of macros in TextExpander. Keep in mind that you don’t need to actually memorize these macros as they can all be inserted using the Insert menu in TextExpander:
These are the different types of macros that are available in TextExpander:
I’m going to break these macros down individually and talk about them in accompanying videos.
Using Date and Time
One of the most practical applications of TextExpander’s macros is for date and time stamping. You can use TextExpander to put in times and dates using different macros for different formatting options. Here are all the different macro options for displaying date and time information:
|%Y||4 digit year number ("2014")|
|%y||2 digit year number ("14")|
|%B||Fully spelled month name ("August")|
|%b||Abbreviated month name ("Aug")|
|%m||2 digit month number ("08")|
|%1m||Month number ("8")|
|%d||2 digit day number ("08")|
|%e||Day number ("8")|
|%A||Fully spelled day name ("Friday")|
|%a||Abbreviated day name ("Fri")|
|%I||2 digit 12-hour clock number ("02" for 2 am or 2 pm)|
|%H||2 digit 24-hour clock number ("02" for 2 am or "14" for 2 pm)|
|%1H||Trimmed 12-hour clock number ("2" for 2 am or 2 pm)|
|%1I||Trimmed 24-hour clock number ("2" for 1 am, "14" for 2 pm)|
|%M||2 digit minutes number ("05")|
|%1M||Trimmed minutes number ("5")|
|%S||2 digit seconds number ("03")|
|%1S||Trimmed seconds number ("3")|
|%p||Expands to AM or PM|
For example, a snippet that would expand to Friday, August 8 2014 – 2:05:03 PM would be written:
%A, %B %e %Y - %1I:%M:%S %p
You don’t need to memorize these macros, however—you can actually select these from inside the insert menu.
Here are a couple more examples of standard date and time format snippets that you can add to TextExpander:
|%d %b %y||8 Aug 14|
|%d %b %Y||8 Aug 2014|
|%B %e, %Y||August 8, 2014|
Adding date and time stamps like this to your notes and information is extremely helpful. We recently wrote a post on the importance of dating everything on Asian Efficiency. Here are a couple examples of things that could benefit from date/time stamps:
- Journal entries
- Meeting notes
- Any form of electronic communication
- Filenames (especially when going paperless)
You can also do date/time math to add or subtract units of time in Text Expander. To do this, simply put the date/time math prefix BEFORE the unit of time you want to modify (you can do this through the insert menu as well—please see the video example). Date/time math macros begin with "%@" and are followed by a "+" or "-" and then the unit of time you want to add or subtract (i.e. "D" for days). For example, "Make sure you file your expense reports from the conference by %@+14D%B %e, %Y" would add 14 days from the current date.
Nesting Snippets within Snippets
Did you know that you can actually put snippets inside of snippets? This is called a Nested Snippet and allows you to use a snippet in more than one place without having to type it out again (or even the abbreviation). To add a snippet inside a snippet, just select it from one of your snippet folders using the "Insert" drop-down in TextExpander and selecting "Snippet", or by using the macro %snippet:(snippet_abbrev) where (snippet_abbrev) is the abbreviation of the snippet you want to use.
This is useful when you want to use a quote within a standard email message. For example, previously I told you about a snippet I created for one of my favorite quotes titled "Fail to Plan" that says "those who fail to plan, plan to fail," which is expanded by using the abbreviation "xplan". I could nest this snippet inside a reminder email for my team members at work to submit their contributions on a particular project, which would look something like this:
Just a reminder that the current sprint is wrapping up this week and we still haven’t received all team contributions. Without all the required pieces it is impossible to roadmap this project and I’m concerned about falling behind on our target dates. Remember, %snippet:xplan.
Simulate Key Presses
This macro simulate a key press. There are four options to choose from: Enter, Escape, Return, or Tab. This can be useful when filling out forms to switch from one field to another without actually having to touch your keyboard—just let TextExpander do it for you! You can do this by selecting "Key" from the Insert menu in TextExpander or by using the macro %key:(key name) where (key name) is the name of the key.
For example, you could create a snippet which filled out your phone number and automatically jumped to the next field for filling out web forms by creating a snippet like this:
However, we highly recommend you do not use this approach for your online passwords. For one thing, TextExpander doesn’t work with secure input fields, but more importantly it exposes your passwords and account credentials to anyone who might gain access to your snippet collection. For example, if you sync your snippets using Dropbox and your Dropbox credentials are compromised, all of your snippets (which are stored in plain text) are accessible. Instead, use something like 1Password to store your passwords securely instead!
Insert the Contents of Your Clipboard
This macro puts the contents of your clipboard into the designated area of the snippet. You might use this when sending an email to multiple recipients (like a party invitation) when you want their name to appear several times throughout the email message. You could copy their name from an invite list and then have it appear wherever %clipboard appears. You can also plug in this macro from from the Insert menu.
Here’s an example:
Hi %clipboard! I’m throwing a birthday party for our friend Thanh next Saturday at Whole Foods (he really loves that place), and I really hope you can come. I know it would mean a lot to him if you were able to make it. Please RSVP to me so we know how many to expect. Hope to see you soon, %clipboard!
Assuming we copied the name "Zachary" to our clipboard before typing the snippet, here’s what it would look like:
I’m throwing a birthday party for our friend Thanh next Saturday at Whole Foods (he really loves that place), and I really hope you can make it. I know it would mean a lot to Thanh if you were able to come. Please to me so we know how many to expect.
Hope to see you soon, Zachary!
Here’s a couple other things that could be used with the %clipboard snippet:
- Phone numbers
- Email addresses
Insert Images with ‘Pictures’
Did you know that TextExpander isn’t just for text? You can actually use it to place images as well. This could be useful for a company logo—for example, when I type "aelogo" it expands into our site logo.
This could also be useful for storing:
- Animated gifs
Place the Cursor Where You Need It
You can use this macro to move your cursor to a certain location within your snippet (called the "insertion point"). You can add this macro by selecting "Cursor –> Position Cursor Here" from the Insert menu or by typing ⌘| (Command + vertical line character).
This could be useful when sending an email to multiple people about a common topic but you still need to customize each message, like telling people what to bring when planning a party. For example:
Thanks for agreeing to help me throw a surprise party for Thanh. Just a reminder that the party is this Saturday at 4 pm and I’ll need you to bring ⌘| for the party. I really appreciate all your help!
This is also very useful for code snippets. For example, I could make a snippet that looks like this:
By putting the macro for moving the cursor (⌘|) between the quotation marks, the cursor will be automatically moved to that position after the snippet is expanded and I can simply type in the value:
You can also move the cursor up, down, left or right of the insertion point. These are represented by ←, →, ↑, or ↓ (⌘<, ⌘>, ⌘^, or ⌘v). For example, if you wanted to move the cursor down two lines at the end of the snippet, you could accomplish this by typing ⌘v⌘v.
Fill-Ins are very powerful macros that allow you to do some crazy things with TextExpander. There are 4 types of fill-in macros you can choose from:
1. Single-Line Field
This macro has one specific field where you can type in the text that you want to appear. For example, you could have a single-line field named "First Name" which would expand with the salutation and a field where you could type in the recipient’s first name. This is a great way to personalize form email templates. You can add a single-line field fill-in by selecting "Fill-Ins –> Single-Line Field" from the Insert menu in TextExpander.
The macro for a single-line field is %filltext% with other options for field name, default value, and width. So if you wanted to use a single-line field fill-in for customizing the top of an email template, it would look something like this:
Hi %filltext:name=First Name%,
This macro would expand to look like this:
Here are a couple other examples where single-line field fill-ins might be useful:
2. Multi-Line Field
This macro is just like the single-line field except you get a text box that you can fill in, kind of like the "Messages" or "Additional Comments" field in many web forms. This is extremely useful for short lists, and the advantage of this over the single-line field is that the multi-line field allows for much more text.
The macro for a multi-line field is %fillarea% with other options for field name, default value, and width, and height. So if you wanted to use this macro inside a snippet for creating paragraph tag text for web development, it would look like this:
To set this up, place the cursor between the paragraph tags and select "Fill-Ins > Multi-Line Field" from the Insert menu in TextExpander. Make sure it’s placed between the paragraph tags, put "Paragraph text" for "Area Name" and leave default value, width, and height alone for now.
In the video example, I’ve named this snippet "p tag" and given it an abbreviation of "xptag". Now when I switch to my text editor I can type "xptag" and the snippet fires allowing me to type my paragraph text in a format that is ready for the web.
Here are a couple other examples where multi-line field fill-ins might be useful:
- Meeting agendas
3. Popup Menu
This macro opens a popup menu with a couple pre-populated options for you to choose from. You could use this when sending out appointment reminders to select the representative the appointment is with or selecting from a limited number of variables, like selecting a product when following up with a customer’s recent purchase.
The macro for a popup menu is %fillpopup% with other options for popup name, popup menu items and default setting. So if I wanted to create a standard snippet to use when following up with a customer, I could create a snippet that says:
%fillpopup:name=Product:OmniFocus Premium Posts:default=Productivity Blueprint:Asian Efficiency Primer:Premium Newsletters:Better Sleep
To set this up, I’ll select "Fill-Ins > Popup Menu" from the Insert menu, name the popup "AE Product", and then fill out the product options as my popup menu items – "AE Primer, Premium Newsletters, Better Sleep, OmniFocus Premium Posts, and Productivity Blueprint". You can also change which option is selected by default (I’ll select OmniFocus Premium Posts).
In the video example, I’ve named this snippet "AE Products" and have given it an abbreviation of "xprod". Now when I switch to my Mail app and I want to send a follow up message to a customer, I can type "xprod", select the appropriate product from the popup menu, hit "OK" and the appropriate text is pasted into the body of my email message.
Here are a couple other examples where popup menus could be useful:
- Date selection (M-F)
- Selecting a team member
- Selecting a product or service
4. Optional Selection
This macro includes a section of text that you can include by selecting a checkbox. You might use if there’s a clause you sometimes include in a contractual agreement or if you sometimes include certain information at the end of a standard email response.
The macro for an optional selection is %fillpart%(optional text)%fillpartend% where (optional text) is the text you want to include in the optional selection. There are other options for Optional Part Name and whether or not to include it by default.
So if I wanted to create a snippet to follow up with someone who commented on a recent blog post, I could create a snippet that looks like this:
Thanks for reading the Asian Efficiency blog. %fillpart%Since you seem to like Omnifocus, you might want to check out this update to Omnifocus premium Posts.%fillpartend%
Now not everyone who reads the Asian Efficiency blog is interested in OmniFocus (hard to believe, I know), so we may not want to include that last part all the time but it occurs often enough that we still don’t want to type it manually either. Using an optional selection within our TextExpander snippet allows us to stay Asian Efficient without anoying our non-OmniFocus using customers.
Here are a couple other examples where optional selections could be useful:
- Customer support links
- References for customers
- Conference call information
Pulling It All Together
The best part about TextExpander snippets is that you’re not limited to just one of these macros per snippet. You can actually link them together and combine them to do some pretty crazy things from increasing your email productivity by storing all your email templates in TextExpander to speeding up your development time by reusing code snippets for developers.
Here’s an example of a fairly complex email snippet:
Hi %filltext:name=First Name:default=First Name%,
Thanks for taking the time to speak with me %fillpopup:name=Webinar:yesterday:default=today:a few days ago%. As we discussed, I’ve prepared a proposal for you. To view the proposal, use this URL: %clipboard
%fillpart:name=Trial%If you’d like to take advantage of our free trial offer, just go to our website – http://ift.tt/UMoRZy.
%fillpartend%%fillpart:name=Portfolio%If you’d like to view or download a sample report, you can do so using this link: http://ift.tt/1kyvVFx
%fillpartend%%fillpart:name=Purchase%If you’d like to pilot the program and purchase a few credits to start, use this URL: http://ift.tt/UMoRZA
%fillpartend%%fillpart:name=Reference%If you’d like to speak to someone who is currently using our products, here are some references you may contact:
123 Not a Real Street
Somewhereville, CA 12345
(555)555–5555 x 1
123 Main Street
Somewhere Else, FL
(555)555–5555 x 2
%fillpartend%I will follow up with you %fillpopup:name=Follow Up:in a few days:default=next week:in a couple weeks% to make sure you got everything and see if you have any questions. If you need anything before then, please feel free to contact me.
Here’s what it looks like when I type the abbreviation:
You’ll notice there are several Fill-Ins that I can customize. There’s one for first name, there’s a popup for when the webinar actually happened, there are optional selections for information I include often but not every time, and a pop for when I’m going to make contact next. There’s also a clipboard reference where I pull in the link for the proposal off of my clipboard.
Using this snippet, once I’ve selected and filled out all the information I want to include, I can just hit "OK" and my entire email has been written for me.
One More Thing: Applescript
Did you know that you can even run Applescript via TextExpander? For example, you could have Applescript snippet that opens the current URL in Chrome instead of Safari. Chrome has built-in Flash support, so this would be one way to get around installing the Flash plugin on your computer if you wanted to avoid that.
Full disclosure: I do not know Applescript, and this example comes from the Smile Software blog. All credit for this goes to them. Here’s how to set it up:
- Set the label "Open URL in Chrome".
- Set the abbreviation (i.e. "cchrome").
- Create a new snippet with content type "Applescript".
- Paste the Applescript into the TextExpander window. Here’s the Applescript:
property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
if appIsRunning("Google Chrome") then
tell application "Google Chrome"
make new window
set URL of active tab of window 0 to theURL
tell application "Google Chrome"
do shell script "open -a "Google Chrome""
set URL of active tab of window 0 to theURL
tell application "System Events" to (name of processes) contains appName
Now just go to the currently open Safari tab or window and type "cchrome". Chrome will open and the current tab will be displayed.
This could be really useful for running Applescripts with OmniFocus, which has great Applescript support.
Putting It to Use
As you can (hopefully) see from this post, there are a ton of possible uses for TextExpander. It’s an incredibly useful utility that will save you a lot of time, but like any tool it’s only effective if you use it correctly. In addition to the examples we’ve covered in this post, here are a couple general best practices for you to keep in mind as you implement TextExpander into your personal workflow:
Sync Your Snippets
You can sync your snippets via Dropbox which allows you to access them via TextExpander touch and other supported apps on your iOS device. To do this, you have to go into "Settings", click on "Sync" and select "Dropbox".
There are quite a few apps that support the TextExpander touch API. Here’s a full list in case you’re wondering whether your favorite app is supported.
Use a Standard Prefix
Thanh talked in this article about the different prefixes he uses for different types of snippets (which is a very logical way to organize your TextExpander snippet collection), but I tend to use a prefix of "x" for everything. There are a couple reasons for this:
- I can’t imagine a scenario where I would type an actual word starting with x that would conflict with my snippets.
- I know when I type "x_" that it is definitely a TextExpander snippet.
- The "x" character is easily accessible on the iOS keyboard (for expanding snippets via TextExpander touch).
Note: There really isn’t a "right way" to organize your snippets in TextExpander. The important thing is consistency. You just need to find something that makes sense to you and is easy to remember.
Think About Practical Uses
Before adding any tool to your workflow, you should ask your self the questions "what problem will this tool help me solve?" Everything needs to have a role and a purpose. In the case of TextExpander, the problem it’s solving is the amount of time spent repeatedly typing words and phrases you commonly use. But if you don’t pay attention and catch yourself repeating things all the time, you can get stuck just blindly going through the motions and continuing to do the same thing over and over.
Instead, you should be self-aware: every time you find yourself doing something more than once, ask yourself "how can I automate this?" With TextExpander, it’s easy—just put in the text you find yourself typing often and it will take care of the rest. But without your own homegrown snippet library, the power of TextExpander won’t do you very much good.
Hopefully this guide to TextExpander has pointed you in the right direction on how to use this incredibly powerful Mac utility, but it’s really only scratching the surface. We’d love to hear how you’re using TextExpander!
A Comprehensive Video Guide to TextExpander | Asian Efficiency
Asian Efficiency was started by two friends, who (unsurprisingly) are both Asian. We saw that there are too many people in the world who are unhappy as a result of living unproductive lives. By starting this website, we (both Aaron Lynn and Thanh Pham), want to show you how to live your life to the maximum by being more productive, so you can go after the things you want in life.
Want to see your work on Lifehacker? Email Andy.
Source: Lifehacker http://ift.tt/1tTxjoR