Text Testimonials: Working with Text in OS X

Text Testimonials: Working with Text in OS X

OK, so this section isn't really about applications, per se. However, much of what you do on your computer (e-mail, word processing, text editing, etc.) is text-related, and Mac OS X offers some helpful and unique ways to deal with text, so I decided that the topic deserved some mention of its own. I'm going to start by talking about tips that work only in Cocoa and some Carbon applications, and then move on to solutions that work in all applications.

Cocoa/Carbon Text Tips

Earlier in the chapter, when I talked about the various types of applications in Mac OS X, I mentioned that Cocoa applications could take advantage of all of the special application goodies in Mac OS X. I also mentioned that some Carbon applications, if the developer chose to do so, can also take advantage of these features. Here are some of the features I was talking about; Cocoa applications, such as iChat, Mail, TextEdit, and Stickies, as well as third-party Cocoa applications, can take full advantage of them; Carbon applications can use them as well, as long as their developers have included the necessary support.

Copy and Paste Formatting

If you've used Microsoft Word for word processing, you're probably familiar with its ability to copy and paste formatting, which can be very useful when you want one block of text to look like another. Cocoa applications all have this ability built in, and you can even copy text formatting from one Cocoa application and paste that formatting onto text in another. In most Cocoa applications, this feature is located at Format Font Copy/Paste Font.

Cocoa Keyboard Shortcuts

Applications generally have their own keyboard shortcuts for menu items and other frequently used commands; however, all Cocoa applications share a set of keyboard shortcuts that are used when working with text. The list of commands is much too long to include here, but if you open Terminal and type bindkey <RETURN> you'll see the entire list. Ignore the quotation marks around a key combination; the ^ character stands for the control key. For example, typing control+T will transpose the characters to the left and right of the cursor.

The Fonts Panel

Accessible from any Cocoa application (and some Carbon apps) via Format Fonts Show Fonts, OS X's Fonts Panel is incredibly useful. If you resize it to its smallest size, you get the most basic font dialog: pop-up menus for font family, typeface style, size, and extras. Resize it to its largest size, and you get scrolling panels for each item, along with a Collections panel (you can create collections of fonts—those that you tend to use together—for quick access). In addition, if you select Show Preview from the Extras pop-up, you get a small preview area that shows you the font, font style, and font size you've selected, along with a preview of your selection.


You can change the preview text by double-clicking in the preview panel and typing your own text. If the preview text is too big to fit in the current preview area, click and hold on the area just below the preview area; you can drag downwards (or upwards) to resize it.

What makes the Fonts Panel especially useful is that it's a floating window, meaning you can keep it open all the time; when you want to use a different font, you just select it from the panel. (If you want to apply a font to a certain section of text, highlight the text and choose the font and style.)

You can also customize other parts of the Fonts Panel. By selecting Edit Sizes from the Extras pop-up, you can add or remove font sizes, and choose to view font sizes as a list, a slider, or both. To create your own collections of fonts, select Edit Collections from the Extras menu. Click the + button to add a new collection, or select an existing collection to rename or remove it using the - or Rename buttons. You can add or remove fonts to or from collections using the arrow buttons. You can also take advantage of the Favorites collection: add a favorite font style by choosing Add to Favorites from the Extras pop-up; remove it by selecting it in the Favorites view and choosing Remove from Favorites.


You can also access Mac OS X's Character and Color palettes from the Extras pop-up menu.


All Cocoa applications can use Mac OS X's built-in spell checker, available from the Edit menu. Some, such as TextEdit, even allow you to enable on-the-fly spell-checking—if a word is misspelled, it will be underlined in red within the document. You can control/right-click on a misspelled word to choose the correct spelling from a list of suggestions, or choose to ignore the word or add it to Mac OS X's dictionary so that it won't be flagged in the future.

Find and Replace

The Find dialog in Cocoa applications also allows you to replace found text with other text. This kind of functionality is most likely old hat to most users, as it has been around in Word and other word processors for years. However, one stumbling block in Find/Replace dialogs has always been how to find (or use in replacement text) characters such as returns and tabs (since the return key usually starts the find, and the tab key usually moves between fields in the find dialog box). To insert a return into a text field, press option+return; to insert a tab, press option+tab.


Services, available from Application Name Services, provide some of the coolest features of Cocoa applications, but (seeing a pattern here?) most people don't even realize they exist. Or, because the Services menu item always exists, but only works in Cocoa or certain Carbon applications, many people think that Services are "broken" or don't work properly.

What are Services? They're one of those things that are harder to explain than they are to use. (That's my disclaimer, by the way, if the next few sentences are a bit hard to grasp.) Basically, Mac OS X allows applications and the system to provide services to other applications from within those applications. For example, you can select text in one application, and then send it to another application to work with it. In some cases you can even use the functionality of another application without leaving the one you're currently working in.

Perhaps an example will make this a bit clearer. In writing this book, I used a database program called DEVONthink to keep track of notes and tidbits of information that I might include in the book. I also spent a good deal of time reading the ReadMe files that come with shareware, freeware, and commercial software. In doing so, I often found useful information about an application that I wanted to remember for later. I could have selected the text from within TextEdit, copied it, switched to DEVONthink, created a new note, and then pasted the text into the note. However, with Services, I could simply highlight the text in TextEdit and then, from within TextEdit, use the DEVONthink service to automatically transfer the text to a new DEVONthink note (Figure 7.14—my Services menu will probably look different than yours, depending on what applications you have installed). What took five steps without Services took two steps with them. I also used this technique quite frequently when browsing Apple's online documentation; many web browsers also support Services, so you can select text in a browser window and then use Services to send the text to TextEdit or any other application that provides a Service.

Click To expand Figure 7.14: Using Services to transfer text from TextEdit to a new note in DEVONthink

Services aren't limited to text, by any means; in fact, they're also supported by the Finder for working with files and folders. However, the vast majority of services are used for working with text, so I've included the discussion of them here.

Summarizing Text

One of the most interesting Services provided by Mac OS X is the Summarize Service. Select a block of text in a supported application, and then choose Application Name Services Summarize. A new window will open in the Summary Service that will automatically summarize the selected text (Figure 7.15). Using the Summary Size slider, you can choose how compact you want the summary to be (100% gives you the original text, 1%—which is only really 1% if you have a lot of text—gives you the smallest summary the Summary Service thinks can be used and still be meaningful.

Click To expand
Figure 7.15: Using the Summarize Service, it's possible to make the Gettysburg Address even shorter

If the Summarize Service sounds useful to you, but you spend most of your time working in applications that don't take advantage of Services, the contextual menu plug-in Abstracter (http://www.mercury-soft.com/) provides similar functionality to all applications.

Installing New Services

Many applications install their own Services the first time they run (or when they are themselves installed). However, some excellent third-party Services aren't provided by an application—they work on their own, and their only interface is the Services sub-menu. (You can find some by doing a search for "service" at http://www.versiontracker.com/macosx/or http://macupdate.com/.) These Services are installed much like many other system add-ons: place them in ~/Library/Services (for use by the current user only) or /Library/Services (for use by all users). After installing a new Service, you need to log out and then back in to be able to use it.

Some examples of useful third-party standalone Services are WordService (http://home.arcoronline.de/grunenberg/), which provides a number of text formatting, conversion, and statistical functions; CalcService (from the same developer), which allows you to type a numerical expression and have it be replaced by the result of that expression; Terminal Services (http://homepage.mac.com/stas/terminalservices.html), which allows you to select text and have it executed as a command in Terminal; and NetService (http://www.dekorte.com/Software/OSX/NetService/), which allows you to perform a number of Internet-based searches on highlighted text—Web, map, Usenet, dictionary, Yellow Pages, and even the eBay auction site.


Many Services (standard and third-party) are also accessible using keyboard shortcuts. These shortcuts are generally listed next to the Service name in the Services sub-menu.

Other Text Tips

If your favorite text-oriented application isn't a Cocoa app, or a compatible Carbon app, don't worry; there are still a number of great utilities out there to help you work faster and more efficiently. (All of these tips work in Cocoa applications, as well.)

Using Multiple Clipboards

The Mac OS has long had a universal clipboard—copy or cut text (or graphics) from one application or document, and you could then paste it into any other application or document. The problem is that each time you cut or copy, you lose the previous contents of the clipboard as they are replaced by the most recent content.

There are a number of excellent utilities for Mac OS X that provide multiple clipboards. Three of the best are the freeware PTHPasteboard (http://www.pth.com/PTHPasteboard/), and the shareware CopyPaste-X (http://www.copypaste-x.com/) and Keyboard Maestro (http://www.keyboardmaestro.com/). You can't go wrong with any of these utilities; however, they each take a different approach. PTHPasteboard is the one I use most frequently, mainly because I find it to be the simplest to use (although it has some great advanced features if you want to go beyond the basics). It keeps track of a user-defined number of recently used clipboard contents (it refers to them as "buffers") in a pasteboard window. You can paste the most recent ten clipboards at any time via keystrokes, with all clipboards available by revealing the pasteboard window. (If you use the pasteboard window often, you can even choose to have it always shown.) To paste a clipboard buffer into the frontmost application— including any styles and formatting—you simply press the number of the buffer you want to use, or click the buffer with your mouse (Figure 7.16).

Figure 7.16: PTHPasteboard's multiple clipboards

In addition to the clipboard history pasteboard, PTHPasteboard also lets you create multiple custom pasteboards, each with multiple buffers, that store frequently used text or graphics. For example, I have one custom pasteboard that holds HTML tags, another that stores personal information such my home and work addresses, phone numbers, e-mail addresses, etc., and another one that stores e-mail signatures. I can access these pasteboards at any time with a keystroke, and then press a buffer number or click on a buffer to paste its contents. Finally, PTHPasteboard also operates as a Service, making it accessible via the Services sub-menu.

Having Your Computer Type for You

If you're like me, there are lots of things you type over and over again, such as the date, your name and address, your phone number, an e-mail signature (or several), and—for those of us who answer a lot of computer questions—even "stock" responses to common questions. Here are a few ways you can automate such typing.

Text Completion/Shortcuts

If you're the type of person who can remember key combinations and abbreviations, you'll love the shareware TypeIt4Me (http://www.typeit4me.com/). Once installed, you can set up shortcuts to frequently typed text that can be invoked from within any text field or document, and are triggered by your choice of keyboard commands. For example, the default TypeIt4Me trigger is the space bar; you can set up a shortcut whereby the letters addy stand for your home address. As you're typing in a document, type addy followed by a space, and TypeIt4Me automatically replaces addy with your full address as you keep merrily typing along. TypeIt4Me also includes several date and time shortcuts to quickly enter the date, the time, or both. The advantage of TypeIt4Me over other utilities is that if you can remember all of your shortcuts, it's amazingly fast and you never have to take your hands off the keyboard. The disadvantage is that you have to remember which combination(s) of characters are shortcuts for what text. If, like me, you tend to forget such things, you'll appreciate what I call "text typers."

"Type" Frequently Used Text

There are several utilities out there that I call "text typers"; these utilities will store various bits of text—words, sentences, or even multiple paragraphs—and type or paste them into a text field or document on your command. This may sound like exactly what TypeIt4Me does, but the difference is that for these utilities you don't have to remember any shortcuts; you press a key or click on a Dock icon, and you get a list of your stored text blurbs to choose from. The process takes a couple more steps, but you don't have to worry about remembering (or forgetting) the shortcuts.

I just mentioned PTHPasteboard, Keyboard Maestro, and CopyPaste-X (when I talked about multiple clipboards). All three allow you to save clipboards permanently, providing you with a quick and easy way to access frequently used text. You simply copy the text to PTH-PasteBoard, Keyboard Maestro, or CopyPaste-X, then when you want to paste it into a document, you use a keyboard shortcut to bring the utility to the front and then select which clipboard you want to paste.

But the text typer I use most often is Typist (http://www.selznick.com/products/typist/index.htm). Typist resides in the Dock and lets me create any number of text entries (including date/time templates). When I want to type one of those bits of text into a document I simply control/right-click on the Typist icon in the Dock, and a menu of my text bits appears (Figure 7.17). Selecting one of these items types it into the document. (If you're a keyboard lover, you can also assign a hotkey to Typist that brings up a list of shortcuts; use the cursor to select one and hit return to type it.)

Figure 7.17: Typist's Dock menu lists the available text bits it can type
Voice Recognition Software

In addition to the kinds of utilities I just described that you use via the mouse and keyboard, a couple of utilities allow you to dictate via a microphone and have your voice transcribed into text that can be entered into any application. ViaVoice (http://www-3.ibm.com/software/speech/mac/index.shtml) and iListen (http://www.macspeech.com/products/iListen.html) are the Mac OS X options available at the time of this writing. I haven't used either product, but both have received good reviews.

Taking Advantage of Clippings

The Mac OS has had text clipping files for years, and Mac OS X maintains this functionality. Highlight a block of text in almost any application, and you can then click and drag that text into a text field or document (in the same or another application). You can also drag the text to the Desktop or any Finder window to create a text clipping; the clipping's name will include the first few words of its contents. Double-clicking on a clipping file opens it in a window showing its contents; dragging the clipping to a text field or document pastes its contents at the location where you drop it.

Clippings are actually another way you can access frequently typed text. You can create clipping files of such text and then store those clippings in a folder or on the Desktop; you can then drag them into a document whenever you need a certain snippet of text. I personally use XShelf, mentioned in Chapter 5, to store a few frequently used clippings in a floating shelf that is accessible from within any application.


There are two drawbacks to clipping files. The first is that unlike clippings in OS 9, you cannot copy their contents without first dragging them into another document. Second, you cannot edit their contents. If you tend to use clippings often and want to be able to edit them and copy them, the shareware application clipEdit (http://www.everydaysoftware.net/clipedit/index.html) allows you to do both, as well as to create new clippings without any dragging.

Cleaning Up Messy Text

You've surely been in this situation before: someone sends you an e-mail with text that you need to use, but it's full of e-mail quote marks (the > symbol), carriage returns, and unnecessary spaces. Or perhaps you've copied text from a web page or PDF file, and it's simply a mess. Chances are you either spend a good deal of time cleaning up the text, or you just say "forget it" and use it as is. If so, you should definitely give textSOAP (http://www.unmarked.com/) or TextSpresso (http://www.taylor-design.com/) a try.

Both utilities allow you to paste text into their "cleaning" window (or open a text file from within the application) and apply one of any number of text cleaning operations (textSOAP calls them "cleaners," TextSpresso calls them "filters"), from removing quote marks and extra spaces and carriage returns, to finding/replacing text strings, to stripping extraneous HTML tags that may have found their way into your text. In addition to cleaning up messy text, both utilities allow you to customize text in myriad ways automatically, using many different preconfigured cleaners/filters. You can also create your own cleaners/filters based on your own needs.

TextSpresso has a unique feature that allows you to batch clean a number of text files at once, and includes an amazing number of filters (over 200!) that perform specific combinations of tasks. For example, a set of HTML-specific filters provide the kinds of cleaning tasks you would be most likely to use on HTML files. It is also much more customizable. However, I still find myself using textSOAP more often, mainly because of the fact that it can operate as a Service. This means that if I have text in TextEdit, Mail, or any other Services-aware application, I can select that text and then choose Application Name Services textSOAP cleaner name and textSOAP will "clean" my text right there in the application.