Automatically Add Recipient's Name to Email with TextExpander

I occasionally have need of a TextExpander snippet to automatically add the first name of an email recipient to the body of an email. Over the years, I've made lots of snippets that have a fill-in field asking me to type in the recipient's name but wouldn't it be great if the tiny robot inside my Mac did it for me? To a certain extent, this quest has been my white whale and I've been plunking away at it when the mood struck me for the past year. I initially went down the road of AppleScript, which never worked consistently. Ultimately, I found success using System Events. Below is the AppleScript code for System Events that pulls the first name from your recipient and types it in the subject line or body of the message.

tell application "System Events"
    tell process "Mail"
        tell text field "To:" of window 1
            if UI element 1 exists then
                set theToRecipient to (value of UI element 1)
                if (count words of theToRecipient) is greater than 0 then return word 1 of theToRecipient
            end if
        end tell
    end tell
end tell

I owe many thanks to Ben Waldie (@AppleScriptGuru) for his assistance in getting this to work. I also had a lot of help on this from Greg Scown at Smile (@macgreg). I put this script into a TextExpander snippet designated AppleScript. It looks like this.

Typing "xnm" in an email will insert the recipient's first name. You can combine them with additional snippets in TextExpander. For example, this snippet ...

... is activated in the subject line. It types "Purchase Confirmation", then hits the Tab Key, jumping to the message body, and then addresses the email to the customer first name and some additional text. Note the phrase "%snippet:xnm%" runs the prior snippet to drop the name in the text. This allows you to run an AppleScript inside a text snippet, which I thought was particularly clever.

Click HERE to download these snippets.

Automating Subject Line and Message Body with TextExpander

The below screencast is one of nine that I did for the new version of TextExpander for the Mac. At the end, I added a bit about automating email subject lines and message bodies with one snippet and I seem to have touched a nerve. I've received a ton of email about this. A lot of people didn't realize this is possible. 

The trick is the Tab key. In most mail applications, the tab key moves you from the subject line to the message body. Setting the curser in the subject line, you can have a TextExpander snippet type the subject line, the tab key, then the message body. For instance:

Subject: How about some waffles?
Dear Jason,
I'm really hungry for some waffles. How about you?

Your pal,

If you are automating email that includes a standard subject line this can be a huge time saver. Don't forget you can also include variables and fill-in snippets in the subject line as well. For instance, if you are standardizing the email for your monthly invoice, the subject line snippet could be:

ACME %b Invoice

which would render as:

ACME June Invoice

Anyway, if this stuff interests you, it wouldn't hurt to watch the below screencast. If you'd like to see more in this screencast series, click on the "Playlist" button. I'm proud of all of them.

TextExpander for Mac Version 5

Today Smile Released TextExpander for Mac, Version 5. The new version has some great new features including the ability to recognize frequently typed phrases and offer to create new snippets for you, remind you when you type a phrase for which you already have a snippet, improvements to fill-in snippets, iCloud sync, and Java Script support. I did a whole series of videos on the new version and they came out great. There are 10 videos in total and they really give you the soup-to-nuts training in TextExpander. If you are already a pro, just watch the "What's New" video below.

TextExpander Signature Line Snippet

This is probably a lawyer thing but I often find myself adding signature lines to the bottoms of documents, particularly contracts. Something like this.

Dated: November __, 2014           ________________
                                                      David Sparks

I was doing this the other day for about the millionth time in my 21-year career as an attorney when it occurred to me I could automate this with TextExpander. Here is my new snippet

The first bit:

Dated: %B __, %Y            ____________________________

This creates a line with the date using the format of Current Month __, Current Year (e.g. November __, 2014). Then it tabs and and draws a line for the signature.

The second bit:


This repeatedly bangs the tab key and then dumps the contents of the clipboard.

The way I use this is to select the person's name from somewhere else in the document, copy it, and then fire off the snippet at the bottom. I use xsigline to trigger this snippet.

This is probably a lawyer-only thing but I do know a few lawyers read this site. Either way, you can download the snippet here.

Pasting Plain Text with TextExpander

There are a lot of ways to paste text. The most common way I do it is with the Command-C and Command-V shortcuts. However, a lot of times you are working with text that is carrying a lot of formatting baggage and when you use the standard paste, the text shows up in your document unusable. Most apps that deal in text give you an option to paste and match formatting and the keyboard shortcut for that is usually Shift-Option-Command-V or some near-variation of that. The trouble is that the shortcut isn't universal and, even worse, some apps that involve text fields don't have any support for an option to paste as plain text.

TextExpander to the rescue. This is perhaps the easiest snippet I've ever posted. I just invoke the clipboard formatted as plaint text. My snippet is xpt (X-Plain-Text). This works everywhere on the Mac. (Even Microsoft Word.) I find typing x-p-t much faster than wrapping my fingers around more complicated combinations or mousing into menus.

I've also got one for pasting rich text from the clipboard, x-r-t, that I use much less frequently. 

I know this is a bit obvious but I showed this to a friend recently and she thought it was pretty swell. You can download my clipboard snippets below. Also, I've got a lot more snippets for download over here.

Clipboard TE Snippets

TextExpander for Quick Defer+Due Dates in OmniFocus

Max Masnick is using Text Expander to quickly enter defer and due dates in OmniFocus. Max primarily uses this for events that have the same defer and due dates. For example if you want a task to disappear but show up as due on Monday at 9am. I don't have much cause for that style task because I so rarely use due dates but there is no reason you couldn't also use this to defer with later relative due dates, for example two weeks from Friday, which in OmniFocus speak would be 2w Fri. Moreover, Max figured out how to combine defer dates and TextExpander so of course he gets a link.


TextExpander touch 2.5 screencast

I had the pleasure of producing a video for Smile Software about the new features in TextExpander touch version 2.5. I’d like the think the video does a good job of getting you up to speed with TextExpander touch regardless of your experience with the app and demonstrates some of the new 2.5 features. The snippet group management is much improved. You can now watch, download, and otherwise consume it at Vimeo.

TextExpander Touch 2.5

Yesterday Smile released TextExpander Touch version 2.5 for iOS. This free update includes a new iOS 7-style user interface and several tools to assist snippet management from within iOS. They spent a lot of time working on the little things and it shows. Some of my favorite new features are:

  • Reordering Groups
  • Sharing a completed snippet with the sharing menu
  • The ability to disable specific snippets for iOS
  • Gestures: three finger tap to share and two finger left swipe to copy

  • iOS Keyboard Shortcuts: 

    • ⌘+ and ⌘- increase and decrease the font size of selected text

    • ⌘N creates a new snippet, group, or note

    • ⌘Return functions as Done, or shares snippet or note

    • Escape functions as Cancel

    • ⌘T toggles between Notes and Groups

    • up and down arrows navigate through the list of snippets or notes on iPad

I use TextExpander often on both the Mac and iOS. The new URL callback method for sharing snippet groups to apps has been working fine and I'm happy to see Smile giving TextExpander even more love. Did you know I've got a bunch of snippet groups right here for download?

Throwaway TextExpander Snippet Tips

Dr. Drang posted this week about the value of throwaway macros and snippets. He’s a fan. So am I. I’ve referred to this before on the Mac Power Users but never posted on it here. Whenever I find myself doing anything remotely repetitive, my nerd-senses kick in and I look for automation. With text, that’s usually done in TextExpander. For example, a few weeks ago I had to ask a series of repeated questions that involved a rotating set of variables.

  1. Where’d you get the ACME dynamite on Contract #X?
  2. Did you leave the dynamite in Y’s expected path?
  3. Was it the same dynamite from Contract X?
  4. Did Y run over it?
  5. Did Y blow up?

My questions were actually a little different but I needed to ask them many times with various combinations of Xs and Ys.

In this case, the contract numbers were a 25 character string of gibberish and I already had a text file with all of the contract numbers in it. So I made the snippet with TextExpander’s clipboard function for the X. (Did you know TextExpander will insert the clipboard contents in a snippet? The syntax is %clipboard.) Before starting the snippet, I’d go to the text file and copy the contract number into my clipboard for my X.

For they Y variable I used a fill-in snippet. Don’t forget that you can have the same fill-in snippet repeat multiple times in a single TextExpander snippet. To do so, simply copy and paste the snippet syntax (e.g. %filltext:name=Sample Fill In%) in the snippet wherever you want it to appear. Then, when you trigger the fill-in snippet typing it once in the first instance fills it in at all of its other instances. Building the snippet took some time but once it was right, populating the questions (there ended up being hundreds of iterations) was fast and there were no mistakes. Overall, it took a fraction of the amount of time I’d have spent doing it manually and was much more accurate. Afterwards, the snippet was completely useless and went into the TextExpander dust heap but for a little while, it was my moon and my stars.

Speaking of TextExpander, did you know I have a whole page of downloadable snippets?

TextExpander Snippets: Media Review

Screen Shot 2013-09-25 at 10.32.56 AM.png

I've started writing up little mini-reviews for myself when I finish watching a movie or reading a book (or comic). I am currently saving these to a text file in nvALT but I also like the idea of saving them to Day One. I originally got the idea from Tulio Jarocki but when I finally got around to it, his site appears down under re-construction. 

Anyway, the snippets all call up some fill-in fields and option fields letting me describe, rate, and review each media. Since I read quite a bit, I find these little notes helpful when recommending books to friends and to confirm whether or not I've read a book already, which, sadly, sometimes takes me 100 pages to realize. 

On the subject of TextExpander, they just released version 4.1 with 100% more EMOJI.

Click Here to Download Media Review Snippets

Taking Better Meeting Notes with TextExpander


At Macworld I sat on a panel with Jeff Taekman, my spirit brother from the medical profession. Jeff sits in on a lot of meetings and talked about how he uses TextExpander snippets and Drafts to speed up note taking. He even wrote it up for Macworld. I took notice and came up with my own meeting snippet, which you can download here.

Meeting Information

 Jeff uses a text description to make the note a header in Notesy (for searching elsewhere), like meetx-david and katie re show. I don’t store meeting notes that way. I keep a bigger note per project that contains a list of meeting notes throughout the project. Text is cheap and it is easier for me to access it all in one place so the meeting information portion of my meeting snippet is pretty simple: description, date, and time.


I use fill-in forms for attendees. Since I work in a small office, I actually do this with an Optional eSlection for my co-workers and a few additional fill-ins for additional attendees. The purpose of these fill-ins is to allow me to use the names again below. Don’t forget how lazy I am.


My meetings often revolve around issues. My notes are typically a few bullet points per issue. This structure has evolved and works for me. It may not for you. You’ll need to get creative here.

The Checklists

I love having checklists from meetings. I love even more when other people know I have checklists. I used to just make it my checklist but now I add checklists for everyone in the meeting. Note how I’ve repeated the fill-in forms here. With checklists—as well as issue lists—I populate the template with many entries. It is much easier to delete than add, particularly on the iPad.

End Time

I like keeping track of how long meetings go. Subconsciously, the fact that I’m going to write down the end time helps me keep things moving, to the extent I have any power over that.

Next Meeting

If I’m really on the ball, at the end of the meeting we’ll agree upon the next meeting date (if necessary) and a preliminary agenda.

After the meeting…

I usually open this snippet in drafts. When the meeting is over, I can email it off to the attendees that have follow up items. I also copy the text and save it my nvALT file for the particular matter the meeting surrounds. On iOS, I can do it through WriteRoom, which is syncing to nvALT on my Mac.

Enjoy and let me know if you’ve got any improvements.

If this snippet is useful, you may also like my conference call snippet.

Download the Meeting Notes Snippet Here.



Easier Conference Call Planning with TextExpander

Organizing conference calls used to be a lot of trouble. It required a pay service, multiple telephone numbers and access codes (that were always changing), and the simple act of getting word out to everyone about the details always took more time than it should have. Times are changing. I recently started using freeconferencecalls.com for conference calls. It’s a great, free service that gives you a single call-in number and access code that never changes. You don’t have to schedule anything with the service. You just send out the number, access code, and time to your call participants and get back to work.


At first I just kept these numbers in my contacts list and used a bit of copy and paste when necessary. After doing this a few times, I realized TextExpander was a much better solution. I’ve now put together a clever little TextExpander snippet that sends out the conference number, access code, and date and time for the call.

I’ve also added a fill-in snippet for the conference call agenda and a pop-up menu for the estimated length of time. I find that if you give people an agenda and time estimate going into a conference call, you’re much more likely to stay on the agenda and complete it within the estimated time.

Now when I have a new conference call to setup, I just open up an email to all the participants, fire off the TextExpander snippet, and send it off. In addition to saving me a lot of time, I think it scares the other participants to the call just a little bit.

I’ve actually got two of these snippets because I have two freeconferencecall.com accounts. One is for the day job (which gets shared with other participants at my office) and the other is for MacSparky.

Here is the snippet in action:

Screen Shot 2013-06-16 at 1.55.21 PM.png

TextExpander touch Snippet Winners

Last week Smile released version 2.0 of TextExpander touch, which I really dig. Yesterday Smile gave me five free download codes to give away for the new app. I put the word out on Twitter to send in favorite snippets for codes and got some really great ones. In fact, I got too many and feel bad about leaving some people out but here comes the winners. Thanks everyone for playing along.

1. MultiMarkdown? Yes thank you.

Sayz Lim submitted a MultiMarkdown snippet to maintain a figure tag in MultiMarkdown. One of the things I like about this snippet is the way he uses the same fill-in snippet twice. I do this often too and I'm not sure everyone knows you can do that.

![ [%filltext:name=Figure Caption%][] ](%clipboard)

[%filltext:name=Figure Caption%]: %clipboard

2. Let Me Know

Trent sent in this simple yet useful script.

ppp = Please let me know if you have any questions.

3. The Breakfast Club Special

Reader Oscar is an educator and needs to send out notices for students that get Saturday detention. He uses this in conjection with an AppleScript that pulls a list of names from a Dropbox text file and works its magic.

The following students have zeros in %fillpopup:name=Classname:Physics:Aquatic Science:default=Forensics% for the week of: %@-9D%m/%d/%y:

%fillarea:name=Student Names%

They need to be assigned to Saturday D-hall on %@+3D%m/%d/%y.

4. Testing, Testing

Michael has a snippet that looks very useful for testing stroke victims. It uses pop ups and several other features. This may not be useful to you but I'm betting there is something in your life that would get easier if you made your own snippet like this one.

NIH Stroke Scale %snippet:.date% %snippet:.time%

1a. Level of Consciousness:%fillpopup:name=1a.:default=0 (Keenly responsive.):1 (Arousable with minor stimulation):2 (Requires strong stimulation):3 (Comatose)%

1b. LOC Questions:%fillpopup:name=1b:default=0  (Answers both questions correctly):1  (Answers one question correctly):2  (Answers neither question correctly)%

1c. LOC Commands:%fillpopup:name=1c:default=0  (Performs both tasks correctly):1  (Performs one task correctly):2  (Performs neither task correctly)%

2.   Best Gaze:%fillpopup:name=2:default=0  (Normal):1  (Partial gaze palsy):2  (Forced deviation)%

3.   Visual:%fillpopup:name=3:default=0  (No visual loss.):1  (Partial hemianopia):2  (Complete hemianopia):3  (Bilateral hemianopia)%

4.   Facial Palsy:%fillpopup:name=4:default=0 (Normal):1 (Minor paralysis):2 (Partial/Central paralysis):3 (Complete paralysis)%

5a. Motor Left Arm:%fillpopup:name=5a:default=0 (No drift for 10 seconds):1 (Drift without touching):2 (Some effort against gravity):3 (No effort against gravity):4 (No movement):0 (Amputation or fusion)%

5b. Motor Right Arm:%fillpopup:name=5b:default=0 (No drift for 10 seconds):1 (Drift without touching):2 (Some effort against gravity):3 (No effort against gravity):4 (No movement):0 (Amputation or fusion)%

6a. Motor Left Leg:%fillpopup:name=6a:default=0 (No drift for 10 seconds):1 (Drift without touching):2 (Some effort against gravity):3 (No effort against gravity):4 (No movement):0 (Amputation or fusion)%

6b. Motor Right Leg:%fillpopup:name=6b:default=0 (No drift for 10 seconds):1 (Drift without touching):2 (Some effort against gravity):3 (No effort against gravity):4 (No movement):0 (Amputation or fusion)%

7.   Limb Ataxia:%fillpopup:name=7:default=0 (Absent):1 (Present in one limb):2 (Present in two limbs):0 (Amputation or fusion)%

8.   Sensory:%fillpopup:name=8:default=0 (Normal):1 (Mild to moderate loss):2 (Severe loss)%

9.   Best Language:%fillpopup:name=9:default=0 (No Aphasia):1 (Mild to moderate):2 (Severe aphasia):3 (Mute or global aphasia)%

10. Dysarthria:%fillpopup:name=10:default=0 (Normal):1 (Mild to moderate):2 (Severe dysarthria):0 (Intubated or other)%

11. Extinction and Inattention:%fillpopup:name=11:default=0 (Normal):1 (To one modality):2 (Profound loss)%

5. The Moxy Award…

… goes to Barry for this.

NTET = Need TextExpander Touch

Are you still waiting to check out TextExpander touch 2.0? Shame on you. You should be watching this clever video.

TextExpander touch 2.0

The new version of TextExpander touch is now available for download and it's fabulous. The big new features are rich text and fill in snippet support. Although this is a version 2.0, it is free for people who already purchased the prior version. The fill-in snippet support is huge for me. I use fill-in snippets every day. Federico did a nice extended review at MacStories and I made a short screencast showing off the new version. Enjoy.

Text Expander Snippets: Date and Time

Here is another group of my TextExpander snippets.

My date snippets fall in a few categories:


Why type August when "xm8" is faster?

Date Math

I don't remember when TextExpander added this feature but I really like the relative date function. If I want yesterday's date for instance, I type "d--"

Date Stamps

Because I date stamp notes from conversations in nvALT notes and they are always a heading two, I have two different versions of the date stamps, one with and one without markdown headings.

AppleScript Date Snippets

These are magic.

xdnm  gets next Monday

xdnw gets the date range next week

xdns gets next Saturday

xdnf gets next Friday

I've written most of these and collected others from the Web. All of the AppleScript based date snippets are courtesy of Ben Waldie. Also honorable mention goes to Tim Stringer, who sent in his list. If you think you've got me licked with something better, send it in and I'll include it with the next update.

Download the Date Snippets

Automating Billing with TextExpander and Automator

In my day job, we use an antiquated old Windows PC system for managing our billing. It takes multiple mouse clicks and butten presses to make a simple entry. It almost feels like I have to walk across the office and turn a wheel somewhere to make a billing entry. Several years ago I decided I was done with it.

Instead, I started making my billing entries in a Byword file called, unsuprisingingly, billings. I keep this file open as I go through my day and make entries with a series of cryptic TextExpander snippets.

For example:


expands to

## Roadrunner v. Coyote



gets me

Place telephone call to opposing counsel concerning

Using these snippets it is really easy to capture billing entries as I move through my day. The Billings file syncs through iCloud to my iPhone and and iPad and I use TextExpander touch on those devices too (syncing through Dropbox) so billing entries are no more difficult there.

Another snippet I use every morning is


Which renders the date and summary information.

#2013-04-10 Billings






At the end of the day, I email the text file off to one of the staff members so she can click buttons, turn dials, and feed coal into our billing system.

About the hundredth time after I copied the text, went and started a new email and then pasted it in, I realized that there must be an easier way to automate this. Of course there is. I use Automator to create and send an email to my assistant every day with my billing text. Here's the Automator service workflow.

The workflow takes the selected text and then prepares an email. It then copies the selected text in the body of the email and uses the recipient and subject line I specify. Then it automatically sends the email. Except for selecting the text and firing off the service, I have no interaction whatsoever. (I should probably attach a keyboard shortcut to make this feel even more magical.)

This is the first automation service I've created that sends off an email without me even looking at it and at first it was a little weird but now I've gotten over it and I love that my Mac does it all for me.