O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


 
Buy the book!
Mac OS X Panther Hacks
By Rael Dornfest, James Duncan Davidson
June 2004
More Info

HACK
#8
Incorporate Services into Your Workflow
The Services menu is an integral part of the tricked-out Mac OS X environment
[Discuss (2) | Link to this hack]

The Services menu is perhaps the most overlooked built-in in all of Mac OS X, despite being a powerful part of the alpha geek's workflow. Services are snippets of functionality exported from Mac OS X itself and the apps you have in your Applications folder.

Think of services as context menu items (such as those you find after a &command;- or right-click) that draw in external functionality and bring them to bear on what you're currently working with. Select the text of a reminder emailed by a friend into a sticky (Mail→Services→Make New Sticky Note) on your Desktop without having to launch Stickies (Applications/Stickies), copy, and paste. Highlight a technical term in any document and Google for it (TextEdit→Services→Search With Google). Select a file anywhere in the Finder and send it via email (Finder→Services→Mail→Send File).

TIP

Perhaps the Services menu would be more widely used if it were indeed made available by &command;- or right-click context menu.

It behooves you to give Services a whirl, working it into your daily workflow. Even if you just end up using the odd service here or there, you'll find it grows on you in no time flat.

The default set of services in Mac OS X, shown in , includes folders for Finder (with Open, Reveal, and Show Info), the Grab screenshot app (with Screen, Selection, and Timed Selection), Mail (with Send Selection and Send To), Make New Sticky Note, Open URL (previously called Net Services), Script Editor, Search With Google, Send File To Bluetooth Device..., Speech (Start Speaking Text and Stop Speaking), Summarize, and TextEdit (New Window Containing Selection and Open Selected File).

Figure 1. Panther's default Services menu

These services are built into the system. Any additional services that might show up were either installed by other programs automatically or manually by you; additional services should all be located in /Library/Services or ~/Library/Services, your own personal library of services in your home directory. Anytime you wish to install more services, you'll put them in one of these two folders, depending on whether you want to make them available to all users on your machine or keep them to yourself.

One of the reasons most folks don't bother using the Services menu—assuming they even know of its existence—is that they find its inconsistency rather confounding. Not all services are available at all times, in all applications, and under all circumstances. If you navigate to your Services menu right now in the Finder without anything selected, several of the submenus (such as Grab's submenu, for instance) will remain entirely grayed out and unavailable to you. Many of the services that are available for use function properly only with something selected.

For example, if I choose Finder→Services→Speech→Start Speaking Text from the Finder without selecting anything first, rather than prompt me for a file or summarily ignoring me, my computer says "C. K. Sample's Desktop." Likewise, choosing Finder→Services→Mail→Send Selection from the Finder without selecting anything causes Mail to attempt to send the entire Desktop folder attached to an email message. However, if you first select a file that you do want to send to someone and then choose Finder→Services→Mail→Send Selection, Mail starts a new message with that file attached. It's all a matter of context; if you can get used to that—and it's well worth getting used to—then services make a whole lot of sense.

Screenshot Services

Although the Grab submenu is nonfunctional in the Finder (and Grab itself is not the best screenshot composer out there, since it produces PDFs of full-screen shots and the Grab menu is always visible), Grab can be useful from within iChat. Navigating to iChat→Services→Grab→Screen in mid conversation automatically launches Grab, takes a screenshot, and places that screenshot in your foremost iChat window, ready to send.

This is much quicker than launching my screen-capture program of choice, FreeSnap (http://www.efritz.net/software.html), taking the screenshot, and then locating the file and dragging it into the iChat window. This service can prove invaluable by quickly and visually instructing long-distance friends and family. Telling Dad that he can find Disk Utility in the Utilities folder in the Application folder inside his hard drive is one thing. Sending him a quick series of screenshots in iChat, showing him where exactly that is and how to get there, is entirely another.

Text Services

Some of the most powerful services, both built-ins and third-party, are text-based services. For example, say you are busy typing up a report for your boss. He calls you up and says that he's having an impromptu meeting in 15 minutes with his superiors and he wants to present a three-minute overview of the 10-page report you are in the process of writing. Rather than scramble to pull together a legible series of note cards that he can refer to in his meeting, you lean on the handy Summarize service.

WARNING

If you are working in Word (at least in Word X), you'll notice that Summarize, along with the rest of the Services menu, is not available to you. You'll need to get your text over to a services-enabled text editor. Select all your text (Edit→Select All or &command;-A) and copy it (Edit→Copy or &command;-C). Launch TextEdit and paste in (Edit→Paste or &command;-V) the text from your Word document.

In TextEdit, select all the text (Edit→Select All or &command;-A) and then choose TextEdit→Services→Summarize. Up comes the Summary service with a shortened form; the quality varies greatly, depending on the type, length, and variability of the writing. shows a summarized version of the opening paragraphs of Jane Austen's Emma.

Figure 2. Summary service, mulling over Jane Austen's Emma

You can specify the service to summarize sentences or paragraphs, sliding your way between shorter and longer versions. To open a new TextEdit document that contains the summarized version for fine-tuning, select SummaryService→Services→ TextEdit→New Window Containing Selection. If your Mac's algorithms put together a summary good enough for the purpose at hand, or if your boss called in the request from out of town, you can simply mail it to him right in his meeting by using SummaryService→Services→Mail→Send Selection.

You can also use this service from within Safari to post a summary of a long article online.

TIP

If you are still using Internet Explorer, it's time to switch. IE does not, and probably will never, support services.

Devon Technologies is a purveyor of some rather nice third-party text services (http://www.devon-technologies.com/freeware.php; freeware). AntiWordService enables any plain text-capable Cocoa application to open Microsoft Word documents; it makes use of the Unix command-line utility antiword. WordService provides 34 functions to convert, format, or speak selected text; insert data; show statistics on your selection; and more. CalcService calculates the result of a selected formula and either appends the result to the formula or replaces the formula with the result.

Lookup Services

Highlight text in any document, web page, or email message and type &command;-Shift-L (or select Services→Search With Google from the current application's menu) to search Google for it.

Nisus Software offers a free Nisus Thesaurus (http://www.nisus.com/Thesaurus), complete with its own Services menu for us writers looking for that (right) (correct) precise wording.

And if you happen across an unfamiliar Klingon word on your favorite Trekkie (or Trekker) newsgroup, use the MacSword Lookup service, which comes free with MacSword (http://www.macsword.com), to search for all appearances of that word in the Klingon Language Version of the World English Bible. There's something for everyone in the Services menu, I tell you!

Bluetooth Services

Wondering just what mischief you can get up to with your Bluetooth-enabled PowerBook and Bluetooth-enabled cellphone or PDA? Send a copy of a public domain book from Project Gutenberg (http://www.gutenberg.net) over for e-book reading in the palm of your hand on the morning bus or train. Simply select the file on the Desktop, select Finder→Services→Send File To Bluetooth Device... (or &command;-Shift-B), and Bluetooth it on over .

Devon Technologies' BlueService (http://www.devon-technologies.com/freeware.php) provides a select-and-send service for any plain or rich text from any Cocoa app (and certain Carbon apps that support the Services menu). All you need on the other end is a Bluetooth-capable device that supports OBEX Object Push or OBEX File Transfer, which your cellphone, PDA, and Mac/PC are bound to support. This is incredibly useful for sending short messages to yourself or nearby friends, MapQuest driving directions to your PDA, party details to a friend's phone, a shopping list to your spouse's handheld, and so forth. If you were feeling adventurous, you could script appointment reminders, breaking news, and other alerts to flow from your Mac to any mobile device currently in Bluetooth range, creating a broadcast network of information for your own personal area.

TIP

Just such a thing has been done, albeit for Linux, by a clever hacker named Collin Mulliner (http://www.mulliner.org/bluetooth). His Bluetooth Joke of the Day sends the joke of the day to nearby devices, Bluetooth FileSystemMapping provides command-line access to Bluetooth devices as if they were local filesystems, and btChat is a Rendezvous-like chat app that uses Bluetooth.

Other Third-Party Services

Third-party standalone services and those advertised by third-party apps abound, as you can see in my tricked-out Services menu in .

Figure 3. A Services menu with all the trimmings

I'm a bit of a services junkie, I have to admit. Here are a few more I've accreted and found useful along the way.

Devon Technologies' DEVONthink personal database program and other similar programs, such as Chronos Software's StickyBrain (http://www.chronosnet.com/&/products/sb_index.html), use the Services menu to allow swift import of selected data into their databases.

If you want to grab a copy of a web page or entire web site for offline reading, WebGrabber (http://www.epicware.com/webgrabber.html) has a Grab URL service.

Search your mail archive in or selected text via the ZOEService service. You'll find it in the Zoe/Extra folder; just drag it to your personal or systemwide Library/Services folder.

If you are a programmer, you'll enjoy the convenience of the Script Editor (http://www.apple.com/applescript/scripteditor/11.html), PerlPad (http://perl-pad.sourceforge.net), and ShellService (http://www.apple.com/downloads/macosx/unix_open_source/shellservice.html) services. ShellService adds an Execute Text command that treats any highlighted text as fodder for the command line .


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.