Mac OS X Hints Page 2 of 2

The insiders’ tips you won’t get from Apple

by Rob Griffiths, Macworld.com

OS X 101: Secrets of the Dock, part 2

In the September issue, I covered the basics of the Dock and how to use the applications stored on its left side. This month, I explore the right side (or the lower half, if you’ve oriented your Dock vertically).

While the left side of the Dock stores applications and only applications, the right side can store documents, folders, and URLs. It’s also where minimized windows hide until you need them again (press Command-M in any open window). And it holds the Trash. You can access the Dock no matter what application you’re in, so you’ll always have quick access to anything you store here.

Documents If you use a file often, consider storing it on the right side of the Dock. Just drag and drop it from the Finder into the area between the divider bar and the Trash icon. You can now open this document with a single click.

Folders To store a folder, drag and drop it into any open space on the right side of the Dock. All it takes is a mouse click to see the benefit of storing a folder here. Click and hold or control-click on the folder (or right-click on it if your mouse is so equipped), and you’ll see a fully navigable pop-up menu of the folder’s contents (see top screenshot). There’s no limit to the depth to which you can drill, though folders holding many items will take some time to display the first time you open them.

URLs If you use Apple’s Safari or The Omni Group’s OmniWeb (or any other browser based on Apple’s open-source Web Kit), you can use the Dock to store Web addresses. Just click on the small icon next to the URL in your browser’s address bar, and drag the URL into an open space on the right side of the Dock. A small spring icon with an symbol on top will appear. Hover the cursor over the icon, and you’ll see the page’s title. If you have a site (or two) that you visit all the time, this is a great way to reach it in a hurry.

Trash Tricks You may think the Trash can’t do anything but delete files, but that’s not true. You can use it to eject disks, iPods, and other removable media. Drag a disk over the Trash icon, and it changes into an eject icon.

With the right side of the Dock, toolbars, and the Sidebar, OS X gives you a number of ways to keep often-accessed items close at hand.

Check It Out: Erase CD-RWs with one click

If you use re-recordable CDs (CD-RWs), you’ve probably longed for a simple, Finder-based way to erase them. Currently, that job requires a trip to the Erase tab of Disk Utility (/Applications/Utilities). But if you’re running Tiger, you can use Automator to build a contextual menu that lets you erase CD-RWs from the Finder.

Launch Automator (/Applications) and click on the Automator entry in the Library column. In the Action column, double-click on Ask For Confirmation. The action will appear in the work area on the right side of the Automator window. Type

Are you sure you wish to erase this CD-RW?
in the message field, and then type
Pressing OK will erase the contents of the CD-RW currently in the drive.
in the explanation field.

Next, double-click on the Run Shell Script entry in the Action column. The action will appear below the Ask For Confirmation box on the right side of the window. In the Run Shell Script box, replace the word

cat
with
hdiutil burn -erase
.

When you’re done, your Automator screen should look like the one shown in the bottom screenshot.

Choose File: Save As Plug-in and give your new plug-in a name—for example, Erase CD-RW. When you control-click on the Finder, you’ll see this name under Automator in the contextual menu. Leave the Plug-in For pop-up menu set to Finder, and click on Save. Now switch back to the Finder, control-click on a mounted CD-RW, and choose Automator: Erase CD-RW from the pop-up menu. After you click on OK in response to the confirmation question, Automator will erase your CD-RW.

Note that I’ve tested this tip only on systems with one recordable drive. If you have both an internal and external drive, you may get unexpected results.

Unix Tip of the Month: Control text from the command line

Have you ever needed to convert a text file from one format to another—say, from HTML to pure text, or from text to Microsoft Word’s .doc format? Though many OS X programs are up to the task, Tiger lets you do it all from Terminal—with

textutil
. The basic form of the conversion command is as follows:

textutil -convert
format name file name

(Important note: For any of these conversion commands to work, you need to either move into the directory where the files reside [using the

cd
command] or specify the file’s full path. To add the path to a command, simply drag the file to the Terminal prompt.)

For example, to create a text file from the raw HTML source you saved from a Web page, you would type the following:

textutil -convert txt MyHTML.html

By default, the output file name will get its name from the input file, but the extension will match the format used in the conversion ( .txt in this example).

The

textutil
command can do more than just convert text formats, though. The
-info
option will give you information such as type, size, length, and (for HTML files) title—just type
textutil -info
file name to see this. You can also use
textutil
to merge multiple text files into one. To merge files, you use the
-cat
option, which comes from concatenate, another word for merge. Just give
textutil
a list of files to merge, along with the format to use, like so:

textutil -cat txt file1.txt file2.txt file3.txt

When you press return, the command will merge the three files into one new file, named

out.txt
by default. If you’d like to control the output file name, just use the
-output
flag to set the path and name:

textutil -cat txt -output MergedFile.txt file1.txt file2.txt file3.txt

Notice that the output file name (

MergedFile.txt
) comes before the list of files you’re merging, not after.

[ Senior Editor Rob Griffiths is the author of Mac OS X Power Hound, Panther Edition (O’Reilly, 2004), and runs the Mac OS X Hints Web site. ]

OS X 101: Storing folders on the right side of the Dock will let you navigate their depths with a simple click.Check It Out: Why bother with multiple clicks every time you want to erase a CD-RW? Instead, create this simple Automator action and access it from the Finder’s contextual menu.
Recommend this story?

"Mac OS X Hints" Comments

Name   City
 
Address 1   State   Zip
   
Address 2   E-mail (optional)
 
See also:

Macworld Resource Centers

Latest on Programming