TextExpander: Change Clipboard Case
01 Oct 2011On Windows I have a useful function in one of my text editors that takes some text and converts the case - to upper case, lower case or sentence case. I realised that on the Mac I could use TextExpander to carry out these functions, so if you’re a TextExpander user and want to have this functionality available to you, I’ve provided some details and a downloadable snippet group for you to use.
In order to produce this functionality we’re going to use the clipboard as the place to hold the text we wish to run the conversion on. This means that the first thing you’ll need to do is copy your text.
In order to process the text I found the easiest way was to use some little PERL scripts. Fortunately TextExpander provides us with a way to call PERL scripts and return the results to insert. This is setting the snippet to a content type of “Shell Script” and using the ‘print’ command to output the result.
The snippet group can be downloaded from the link below and installed into your own copy of TextExpander. You may also want to check out my earlier post on how to import and export snippet groups in TextExpander.
Details of each of the snippets are given below.
Label | Paste Clipboard Text (Lower case) |
Description | Alphabetic characters are converted to lower case alphabetic. E.g. "i am lower case. so i only have lower case characters." |
Abbreviation | %lclip |
Content |
|
Label | Paste Clipboard Text (Upper case) |
Description | Alphabetic characters are converted to upper case alphabetic. E.g. "I AM UPPER CASE. SO I ONLY HAVE UPPER CASE CHARACTERS." |
Abbreviation | %uclip |
Content |
|
Label | Paste Clipboard Text (Sentence case) |
Description | The first character is converted to upper case alphabetic. The remaining characters are converted to lower case. E.g. "I am sentence case. So i only have an upper case character at the start of each sentence, with the remaining alphabetic characters in each sentence being lower case." |
Abbreviation | %sclip |
Content |
|
Label | Paste Clipboard Text (Title/Proper case) |
Description | The first character is converted to upper case alphabetic. The remaining characters are converted to lower case. E.g. "I Am Title Case. So I Have An Upper Case Character At The Start Of Each Word, With The Remaining Alphabetic Characters In Each Word Being Lower Case." |
Abbreviation | %tclip |
Content |
|
A newer version of these snippets is available that is also compatible with iOS for those using TextExpander5+ on Mac and 3+ on iOS.