How to generate a random number with TextExpander

While horribly priced (especially for new users), TextExpander is currently a key part of my daily work. In a nutshell, TextExpander is a text replacement app: you can define shortcuts, and when you type one of the shortcuts it will get replaced by a chunk of text you previously defined. It is a convenient way to save time.

For instance, I have a shortcut oscc that turns in Olivier Simard-Casanova: when I type oscc, it is automatically replaced by Olivier Simard-Casanova. This kind of text replacement is called text expansion.

TextExpander allows for some kind of automation, for instance you can automatically display the current date or time. But I needed to generate random numbers, something TextExpander does not offer – and their support pages are dreadful.

TextExpander can accept JavaScript code as snippet. I just needed to specify the snippet’s content is JavaScript, and the following code did the job:

Math.floor((Math.random() * 1000000000) + 1);

Now, every time I type rnumb, it is replaced by a random number between 1 and 1000000000.

This article is not a TextExpander endorsement

If you don’t use text expansion yet and want to give it a try, I strongly discourage you to go with TextExpander. 40$/year for a small utility like TextExpander is insane, especially knowing that their so-called “sync” engine is far from perfect – a.k.a. buggy. And don’t by the standalone apps, they basically don’t updated them anymore, only bug fixes and removal of key features like Dropbox sync…

The only advantage of TextExpander is to exist on Mac, iOS and Windows – and as my work machine is currently a PC… You see why I stick with them. I also have a lifetime 50% discount on the yearly pricing – but even at 20$/year, I still find Expander overly priced, especially considering how rare new features are added since they switched to subscriptions.

You should also be aware that they run their own sync engine. I don’t trust small companies that build a “cloud” as a side feature, especially for security reasons1This is why I am so reluctant to go with the 1Password subscription.. For instance Day One, that made some really bad design choices that lead to data breaches or frequent outages (compare with Dropbox). TextExpander took almost a year to encrypt the synced data stored on their servers, and to be honest, I don’t wonder if a data breach will occur on TextExpander sync, but when.

If you only have a Mac, I recommend to go with aText (one-time 5$ fee$!) or TypeIt4Me (one time 20€ fee, an iOS app is available too). I don’t know for Windows.

Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Notify of