Automators 22: Text Expansion

3 Likes

Are there any decent yet free TextExpander alternatives for iOS out there?
I like TE but honestly I find $4/mo way too pricey (for my usage level anyway)

Thanks for another great episode, Rose and David!

I discovered that it is, in fact, possible to have multiple lines in a Text Replacement shortcut (i.e. using the functionality built into Mac and iOS). The trick is to copy and paste the text into the With field on a Mac rather than trying to type it into this field.

For example, if I wanted to create a Text Replacement for the following text that expands when I enter xaut22…

Automators #22: Text Expansion - Relay FM

Text expansion is a simple sort of automation but also a powerful one. In this episode, Rose and David go deep on text automation, the tools they use, and some of their favorites ways to use text automation to get their work done faster.

…I could add a new Text Shortcut on the Mac (System Preferences > Keyboard > Text) by typing xaut22 into the Replace field and copying and pasting the above text into the With field.

Typing xaut22 and pressing the spacebar on either Mac or iOS will expand the text, complete with paragraphs/line breaks.

One caveat is that there appears to be an upper limit on the length of these expansions. Though, I have successfully created expansions with 1,600+ characters and multiple paragraphs.

I’ll continue to use TextExpander for most of my snippets (and appropriately enough even have a TextExpander snippet for “TextExpander”), but the built-in text expansion facility is more convenient in some cases, especially for frequently used email text.

3 Likes

You can buy the old version 5, then you’ll be eligible for the lifetime 50% discount on version 6. Over time this can make it more affordable.

Oh this is GREAT news!!! I remember specifically trying this many versions ago to no avail. So they must have updated it! Fantastic - thank you for pointing out!

1 Like

There is also aText, which I’ve extensively used in the past. It’s basically offering the same functionality than TextExpander without an iOS version for a fraction of the price (4.99$). It’s actively maintained (not too many functions added over the years, but it has regular updates). I don’t know why so few know about the app, as it’s a very complete text expansion app and a very cheap one.

My only complaints about it (and the reasons I decided to switch to TE):

  • No iOS version, hence no sync or expansion in the iPad and iPhone
  • It’s basically a ripoff of TextExpander. It has exactly the same functions, and even a very similar UI. I just felt bad, as it seems the developer took TE and rewrote a bit to avoid licensing problems, then released the app. Other text expansion apps have their functions, UI, details that make them unique. aText, if you used TE, feels exactly the same (and it even imports all your TE snippets perfectly).

When I started playing around text expansion, TE was, as for you, a pretty big investment for the use I was going to give it. I got aText and used it for 4 years, but now my usage’s gotten more intensive and TE offers just more to justify the change.

1 Like

I listened to this podcast and while David’s day to day job as a lawyer made TE useful to him, my current text expansion is limited to a few things such as form filling and typing user name in the various websites I logon to. As such, I find that Alfred’s built in text expansion serve my need. However, I like Rosemary’s \ to trigger the text expansion and will adopt this. Makes more sense as compare to my own special shortcut keyword which sometimes get triggered accidentally.

1 Like

You’re very welcome, Andre. Great to hear this was helpful!

1 Like

Backslash is problematic if you’re a programmer as it’s often used to start an escape sequence e.g. \n and \t.

What I picked up was the use of tab for tabbing between fields in web form. However, my usage will make that relatively rare.

Fortunately I am not a programmer, so I think backslash will still work for me. We’ll see. I thought about using forward slash, but sometimes I use Terminal and that’s used in directories.

Bad news: Backslash is used to escape a space in filenames - in Terminal. :slight_smile:

The choice of initial prefix isn’t actually as critical in the ways it is being suggested here. Let me try and give an explanation as to why I believe this to be the case.

The full trigger string is what is actually important, though there is a factor to consider around the prefix which I’ll come to shortly.

To begin with, let’s take a backslash as an initial prefix example. If I need to type in a newline code of \n, then as long as I don’t have a snippet trigger string of \n for something else, it will trigger just fine. I could have \foo, \bar, \quz, \qux. None of those are \n, so none of those get triggered.

Now if I did have \n set as a trigger then it would be a problem, because as soon as I enter that, along with whatever additional options I may have set (e.g. only trigger before, after a whitespace, etc.), then that string is replaced and I lose it. There could be some mitigation here by further restricting a string to be case sensitive, but that’s unlikely to safeguard all potential scenarios.

If I had a trigger string set as just \, that could potentially be even worse, as I could run the strong risk (options above considered) of triggering an expansion it before I even get to the n.

The things to really watch out for is trigger string overlap.

Let’s say I define two text expansion strings:

  • \foo is set to expand to foo-foo-foo.
  • \ooba is set to expand to ooba-looba-do.

If I want to define a new text expansion with a trigger string of \foobar, this would never trigger. As soon as I got to the second o, the \foo expansion would trigger and I’d end up with foo-foo-foobar assuming instant expansion (which is honestly rather unlikely on my devices).

If I then disable the \foo, I’d next get the ooba expansion triggering when I try to type in \foobar. As a result, I’d end up with something like \fooba-looba-dor, and that’s just gibberish :wink:

But the point here is to focus on unique string permutations that do not overlap.

Now back to the prefix. It is quite common to use a prefix for text expansion to make that initial trigger string unique. Now if I wanted to use say home as some sort of trigger for expanding to produce my home address, that would be great for it being easily remembered and being meaningful to me. But it would be terrible as a choice of trigger as there are many words in the English language that use the letters ‘home’ in that order. Now whitespace in some text expansion apps can be used to help curtail accidental triggering, but given it could prefix or suffix a larger word, that wouldn’t help here. Instead this is where a prefix would come into play.

By selecting some character to prefix the string and make it unique enough that it wouldn’t show up accidentally in another word (or in fact any string … sometimes extra care with passwords is required regardless of whether apps support password field security options :nerd_face:). Hence I might choose ;home, \home, hhome, or xhome for example. All trigger strings that I’m very unlikely to come across in day to day text entry.

Now there’s one final point on this that might be of note to iOS users and I was pleased to hear get a reference in the episode. It’s one I really need to get around to sorting out as my naming extensions predate iOS and I’m now using them (through TextExpander) daily across Mac, Windows and iOS and it isn’t as efficient as I’d like. The issue is quick access to the prefix character. I actually use a suffix character, but my issue remains the same - my choice of character isn’t one that’s quickly accessible from a soft keyboard on iOS.

The result is that it takes extra taps to produce the string when not at a hardware keyboard. Definitely a first world problem, but irritating for something whose sole purpose is to save you keystrokes.

So if you are an iOS user and you want to use a character prefix (or suffix) to your triggers, my advice would be to choose something you can see on your default iOS keyboard layout. You’ll be all the faster for it.

7 Likes

In addition to what you’ve covered here, I also disable text expansion (for specific groups in TextExpander) in my IDE and other applications - such as BBEdit and Terminal, which can be yet another way to work around clashing snippets.

7 Likes

I think I heard Rosemary say she has some expansions that start with X. I hadn’t thought of that but how many English words have X or even more, Q not followed by U? Qaddr could be a trigger for the address, etc. I know I won’t be typing Q without a U in normal use.

One thing I use is not just hard words or names but one of the companies I deal with in my work is The Boston Tea Party Ships and Museum™ so I added a snippet for btps to expand to the full name with the ™ trademark symbol as required by my company. That is one of my favorite uses of Textexpander to add service marks or trademarks or copyright symbols where necessary.

1 Like

BTW @RosemaryOrchard I was surprised to hear you say you don’t normally type “xh” as “xhr” is a common abbreviation for “XMLHttpRequest”. :slight_smile:

This post

revolutionised my snippet organisation.

Dot notation seems so logical and is very easy for me to remember.

u.c - ulysses comment
add.h - home address
e.u - university email
d.t - today
d.pz - date in prose, South African (ZA) style e.g. 2 May 2019

etc.

1 Like

I use JSON, not XML :wink:

Is there a good example of the applescript snippet that takes the name of who you are sending a email to?

Try the email episode discussion. I think there are a few variations in there.

1 Like

Off topic, I know, :slight_smile: but xhr can return JSON. As it happens most of my use of xhr is returning localhost-served lists.