Processing the Clipboard
The group I decided to recreate was one of my most popular. It contains a number of snippets that output modified contents of the device’s clipboard. The original group included five snippets:
- Paste Clipboard Text (Lower case).
- Paste Clipboard Text (Sentence case).
- Paste Clipboard Text (Title/Proper case).
- Paste Clipboard Text (Upper case).
- Sort Lines Alphabetically.
You can read about the original snippets in the Change Clipboard Case post and the Sort Lines post.
As a bonus I actually also decided to add an additional snippet to provide a reverse alphabetic sort - it was pretty trivial to include.
The sentence and title/proper case snippets took a little more work. Each of these uses a function (set as a string prototype function) to modify the string it is passed. Each uses a regular expression to determine how to chunk up the string of text for capitalising. Both work on the same principle; we want to capitalise the first letter of each chunk. For sentence case we want to chunk into sentences and for title/proper case we want to do chunk into words. The regular expressions are therefore relatively similar in approach. For each chunk returned, the remainder of the function is the same. Set the first character to be a capital letter and the remaining characters to be lower case letters.
Get the Snippet Group
The snippet group containing these snippets 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.
|Label||Convert Case to Lower [Clipboard] (JS)|
|Description||Output the clipboard contents in all lower case.|
|Label||Convert Case to Upper [Clipboard] (JS)|
|Description||Output the clipboard contents in all upper case.|
|Label||Convert Case to Sentence [Clipboard] (JS)|
|Description||Output the clipboard contents where every character is lower case except for the start of the sentence which is in upper case.|
|Description||Output the clipboard contents where every character is lower case except for the start of each word which is in upper case.|
|Label||Sort Lines Alphabetically [Clipboard] (JS)|
|Description||Output the lines of text on the clipboard sorted into alphabetic order.|
|Label||Sort Lines Reverse Alphabetically [Clipboard] (JS)|
|Description||Output the lines of text on the clipboard sorted into reverse alphabetic order.|