# Automators 22: Text Expansion

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.

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

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 ). 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”.

This post

revolutionised my snippet organisation.

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

u.c - ulysses comment
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

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, but xhr can return JSON. As it happens most of my use of xhr is returning localhost-served lists.

Good episode! I have replaced most of my TextExpander snippets with either the build-in text expansion or with Keyboard Maestro scripts as my text expansion needs are either very simple or involve Apple Script or more complex scripting anyway.

In the end, I don’t think that it makes a lot of difference, use what you like best and what makes you productive.

Thanks for the suggestion.

Still not free, though.

Any other suggestions?

Such a great episode! I use TypeIt4Me app and it works great sometimes. It seems to get stuck a lot in the “secure input” loop. However Keyboard Maestro has never failed me, and to be honest i do not see the use of neither TypeIt4Me or Text Expander when i got Keyboard Maestro, can anyone name one feature that these programs has that Keyboard Maestro lacks?

How can I access the internal text expansion feature for MacOS? All though I like TextExpander, and I do use it especially on iOS. I don’t want to pay the monthly subscription fee once the trial has ended. I don’t use it often enough to justify the nickel and diming.

System Preferences > Keyboard > Text (in High Sierra - don’t think it has changed in Mojave)

1 Like

I like PhraseExpress. It’s a one-time fee, not a subscription like TE. It conflicts with PopClick.

1 Like