QA Graphic

Going Random with TextExpander

As a tester, I sometimes have a need for a random word. For example, I may need a unique word for creating a new account in my system. Using the Shell Script feature in TextExpander now makes it easy to add a random word whenever I need to.

Here are the simple steps to create a TextExpander Snippet so that you can instantly insert a random word whenever you need it:

random word
  1. Open up TextExpander and create a new Snippet.
  2. Change the script Content type to 'Shell Script'
  3. Enter in the following code:
    lines=$(cat $WORDFILE | wc -l);
    sed -n "$rnum p" $WORDFILE | perl -pe 'chomp'
  4. Click on the 'eye' to get a preview to make sure that it works.
  5. Enter in 'Random Word' as the Label.
  6. Enter 'rrandom' as the Abbreviation. (Makes it easy to remember!)

The root dictionary, /usr/share/dict/words as my random source library is good choice since their are 235,886 words available.

There are many ways to get a random word, I selected using the above method since it seems to be the quickest way. If you know of a better option, let me know!



Add Comments




I find TextExpander, by Smile on My Mac, to be an awesome productivity tool. This past winter, I posted some cool snippets that demonstrate the power of the application. Occasionally, I will post some new snippets that I think will be useful in anyone's TextExpander library.


SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
WednesdaySnagIt for QA