WordService - Add useful text handling to Cocoa apps
Jan 31, '05 10:01:00AM
Contributed by: robg
The macosxhints Rating:
With the recent release of iWork, many folks seem interested in using Pages to replace their current word processor. As I noted in my preview for Macworld, there are many things that Pages will not do. Depending on your needs, this may make using Pages as your everyday word processor impossible. There is, however, a nice workaround for one of Pages' limitations -- the inability to count words and letters for anything other than the full document. Most anyone who has written for any publication will need a feature like this, as there are many things (captions, sidebars, etc.) that may not count in your total word limit, so an overall document count isn't that useful.
[Score: 10 out of 10]
Enter WordService. As seen in the image at left (larger version), WordService will give you a nice summary of the characters, spaces, letters, lines, and words in any selection of text. But how does it work? Simple, it's a service. Once installed, it's an entry on your Services menu. This means it will work in all Cocoa (and some Carbon) applications -- and Pages is Cocoa. So just highlight a bunch of text, then choose Services -> Statistics, and you'll get that nice count window.
But wait, that's not all! You'll also get three more amazingly useful services menu entries, each of which contains multiple tasks. The Convert service lets you change the case of text (including initial caps of words or sentences), change straight and "smart" quotes, convert line endings (Mac vs. Unix), and convert tabs to spaces (or vice versa). The Format service offers up options to reflow text, remove multiple spaces between words, sort lines in ascending or descending order, and various trim options. The Insert service lets you add various forms of the date, time, or date and time, or the contents of the path. There's actually a fourth service as well, called Speak Text, which will speak the selection in your native language or German (as well as Stop Speaking, in case you started a long one and don't want to let it finish).
I'll admit I haven't used the Speaking service much (OK, at all!), but I really like the others. With Pages in particular, it's doubly-useful: Pages not only lacks selection counts, but any form of text case conversion other than "all caps" or "small caps" -- what about "sentence case?" With WordService, those two features are fairly easy to access, and basic text manipulations are but a text selection and Services-menu-item away, in any Cocoa application (Mail, TextEdit, Keynote, Safari...).
Mac OS X Hints