Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

WordService - Add useful text handling to Cocoa apps Pick of the Week
WordService icon The macosxhints Rating:
10 of 10
[Score: 10 out of 10]
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.

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...).
    •    
  • Currently 1.90 / 5
  You rated: 3 / 5 (10 votes cast)
 
[20,412 views]  

WordService - Add useful text handling to Cocoa apps | 22 comments | Create New Account
Click here to return to the 'WordService - Add useful text handling to Cocoa apps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Useful Applescript
Authored by: bonkydooky on Jan 31, '05 10:17:05AM

Interesting...I just wrote this Applescript last week (I keep it in my Scripts menu). It might come in handy for someone who doesn't want the full functionality of WordService. I suppose it could count spaces if modified to use Applescript's text delimiters.

set myclip to the clipboard as string
set the reportnum to the count of words in myclip
display dialog "The clipboard contains " & reportnum & " words."



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: bluehz on Jan 31, '05 10:26:19AM

Be cautious with WordService... I tried many versions and many times to use it and it would often appear as the root of unexplainable crashes and instability when it was active. Disable it and all was well again. Sure would like to use it - just too buggy for my taste.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: seven5 on Jan 31, '05 10:31:31AM

another 10/10 review. Seriously, is this a 10 star piece of software? has anything ever gotten an 8 here?



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: robg on Jan 31, '05 01:03:24PM

Last week was an 8, as a matter of fact. And keep in mind these are "Picks of the Week." There are occasionally 7s as well, though I'm not sure I've given a 6.

Keep in ming that these are all apps that I personally like and find useful, hence they start with a high score already. If they didn't, they wouldn't be here. This is *not* a software review, merely a pointer to an interesting piece of software.

My criteria for a 10 is pretty simple for a PotW: No glaring bugs, no glaring omissions, it must be priced right with its competition, and it pretty much does what it claims to do. I don't mark down for features not included, unless they fall into the glaring omissions category (Pages and page management, for instance :) ). If it meets those criteria, and isn't insanely ugly, it'll probably get a 10.

-rob.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: jsuter on Jan 31, '05 11:02:08AM

It is also too bad that it won't work in Word. In fact, I can't get ANY of my text-related services to work in Word. Anyone know why??



[ Reply to This | # ]
Microsoft Word isn't a Cocoa application
Authored by: Bookman on Jan 31, '05 12:06:17PM

At least v.X isn't. Not sure about Word 2004. My understanding is that Services--that is, things you find under the Services submenu under an applications name menu, e.g. Word--are only available to applications programmed in the Cocoa language.

--Books



[ Reply to This | # ]
Microsoft Word isn't a Cocoa application
Authored by: jsuter on Jan 31, '05 01:16:04PM

Yep - I'm running 2004 and it still isn't Cocoa. Lousy Microsoft.



[ Reply to This | # ]
Microsoft Word isn't a Cocoa application
Authored by: DanFrakes on Jan 31, '05 02:39:56PM

They're also available in Carbon apps *if* the developer has chosen to add support for them. For example, Entourage 2004 supports Services even though Word 2004 does not.



[ Reply to This | # ]
Awesome, thanks
Authored by: jsuter on Jan 31, '05 04:19:02PM

Even on Windows there are a whole whack of inconsistencies between the various office applications. I wish Pages was a little less Quark-like and was more the half-way between BBEdit and Quark.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: Kool on Jan 31, '05 11:33:59AM

I have been using WordServices since, well forever... I use it a lot! Especially the Reformat option to get the enters out of text.

Technically also Carbon apps could use it, if they would incorporate the right API. MS hasn't done this and therefor you can't get Service to work with it.

I have only good experiences with this software. I've never had any crash related to this software.

It's not a 10/10, but 7/10 in my eyes. There is some room for improvement I think. (though some issues are related to bugs in OS X)



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: robg on Jan 31, '05 01:07:16PM

See above for my take on what makes a PotW a "10." I really don't count down for features not included unless said feature is notable in my daily use. Since WS does what I need it to do, I haven't noticed any glaring missing features. It hasn't crashed, and it's free. Hence the 10.

10s here are not nearly as hard to earn as a 5-mouse rating in Macworld, primarily because (a) this is software I already like, and (b) these aren't full nitpick-every-detail reviews. They're meant to be informative pointers to potentially useful apps, and that's about it.

But that's the beauty of rating systems; many of them, including this one, are highly subjective :).

-rob.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: Bioinformatics on Jan 31, '05 02:09:21PM

From what I've read elsewhere, iWord <i>can</i> count words, its just not on the top menu, but buried further down. I can't help you with where, but at least you know to look! But nice hint all the same.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: robg on Jan 31, '05 03:12:58PM

Pages *can* count words. It cannot count words in a selection. I've looked, read the manual, taken the user's tour, tried every menu selection with and without a selection active ... if it's in there, I have no clue where it's hiding.

The overall count is in the Document tab of the inspector, on the Info tab of that tab (if that makes sense :)). It gives you all sorts of counting stats, but they are for the entire document. This is the only word count option mentioned in the manual.

Until someone proves me wrong, I don't see any way to count words in Pages unless you want the count in the total document. I've probably spent a good three hours looking for it, scattered over my time with the program.

-rob.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: adrianm on Jan 31, '05 05:45:22PM

3 hours looking for a selection word count? You should get out more.
:-)



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: robg on Jan 31, '05 06:01:17PM

Hehe ... I was involved anyway, doing the writeup for Macworld. So off and on, I went digging. It seems so ... obvious. But no, not there, near as I can tell.

-rob.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: dbmartyn on Feb 01, '05 12:10:05AM

To get a Word count in Pages select the 'document inspector' and then select the 'info' tab.



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: robg on Feb 01, '05 09:38:39AM

Please read the comments -- you cannot get a word count for a *selection*, only for the entire document.

-rob.



[ Reply to This | # ]
HTML Tidy Service
Authored by: pixelfreak on Jan 31, '05 04:47:53PM
If you're a web developer, you might be interested in my free Service which uses the HTML Tidy library to process markup. Tidy Service allows you to apply HTML Tidy in any application that supports services by selecting the markup in question, then choosing Tidy Markup or Tidy to XHTML from the services menu. Custom HTML Tidy options can be set by creating a config file in your home directory.

Tidy Service

[ Reply to This | # ]

Useful Services
Authored by: Enkerli on Feb 01, '05 04:19:06AM

Interestingly enough, I was coming to the site to look for info on Services. Was installing Devon's Services Pack (including WordService).

Have been using WordService for a long time and it has proved extremely useful. In fact, Services are among the coolest features in Mac OS X, IMHO. The word count/statistics, though not live, can be a huge help. And Nisus Thesaurus provides a service for lookup or replace. Really neat. Not to mention CalcService, also part of DevonTech's Services Pack: select an equation, and the service solves it directly.
Other apps offer Services, including some reference management software (BibDesk, Endnote), some with auto-completion!

Is there a good repository for Services? Or just a guide to OSX Services in general?

Thanks!



[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: encro on Feb 01, '05 07:30:26AM

The AppleCore Project Web Services are another great option with 200+ services:

http://rixstep.com/4/0/aws/



[ Reply to This | # ]
Text Case Conversion
Authored by: earlshango on Feb 02, '05 08:15:30PM
From the article: "Pages...lacks...any form of text case conversion other than 'all caps' or 'small caps' -- what about 'sentence case?'"

Text case conversion more robust than that found in the Format >> Font >> Capitalization menu, is located in the Typography Inspector, which can be accessed via the Font Inspector's Action menu (the one with the gear icon on it).

Here, there's Initial Caps, Lower Case and Upper Case. Sentence Case is still a job for WordService though.

[ Reply to This | # ]
WordService - Add useful text handling to Cocoa apps
Authored by: pete.boardman on Feb 03, '05 05:14:19AM
If you want to get into making your own services, investigate Bellhop (xendai.com). Here's a Count Words in Selection (using spaces as delimiters) written for use with Bellhop and Growl. (I like Growl's unobtrusive display.)

on runService (aPasteboard)
	set theText to readPasteboardString(aPasteboard, NSStringPboardType)
	set theWordCount to countWords(theText)
	tell application "GrowlHelperApp" 
	notify with title "Words in selection" description theWordCount  icon of application "Bellhop" with sticky
	end
end runService

to countWords(s)
	set oldTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to " "
	set theCount to count the text items of s
	set AppleScript's text item delimiters to oldTID
	return theCount as string
end


[ Reply to This | # ]