Mac OS X Hints

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

1 2 3 Page 2
Page 2 of 3

Quick-Access Encyclopedia

Wikipedia is a large, community-driven encyclopedia. Any-one can add new records or modify existing ones. The idea is that over time com-munity members correct each other, and you’ll wind up with a very detailed collection of facts. It may not be the Encyclopaedia Brittanica, but it’s a great starting point for learning.

However, loading the Web site, entering your search terms, and clicking on the search button can be time-consuming. Lo and behold, by writing a simple script, you can run your queries from a Terminal window instead.

Unix holds executable programs in a folder called bin, so go ahead and create a bin folder in your Home directory, at the same level as Documents, Pictures, and so forth. You can do this via the Finder or type

mkdir ~/bin
in Terminal.

Once you’ve created this folder, make sure Unix knows about it when it looks for programs to run. In Terminal, create a file named .bash_profile in your home folder (or edit that file if it already exists). Start by typing

pico .bash_profile
.

Next, add the line

export PATH=~/bin:$ PATH
.
EDITOR’S NOTE: There should be no space between the dollar sign and the word “PATH.”

Now press control-O (for Write Out) and then press return (to save the file). Then press control-X to exit the pico editor. Close and reopen your Terminal window; this will read the newly created .bash_profile file, telling Unix to look in your local bin folder for executable files.

All that’s left to do is to create the Wikipedia script (See top screenshot). Type

cd ~/bin
, press return, type
pico wp
, and press return again. You’re now editing the new script. Enter the following two lines:

	#!/bin/bash
	open http://en.wikipedia.org/wiki/Special:Search? search=$(echo $ | sed 's/\\ /+/g')
	

When you’re done, the entry should look like the image in “Wild Wiki Ways.” As before, press control-O, return, and then control-X to save the file and quit the editor. The final step is to turn your script into an executable file. To do this, type

chmod +x wp
. Press return to turn those two lines of text into a simple program.

To use your new script, just type

	wp
	some text to search for
	
and press return. Replace some text to search for with your search topic. Short phrases—
wp racehorse
or
wp macintosh
, for example—will probably lead to broader results.

When you press return, your default browser will open and load the Wikipedia results page for your search terms.

Here’s a short bonus tip: If you’ve already installed a text-mode browser such as links or lynx, then modify the above script so that the results display directly in your browser. Just replace the second line of the script with this text, replacing

lynx
with
links
if appropriate:
lynx http://en.wikipedia.org/wiki/Special:Search? search=$(echo $ | sed 's/ /+/g')

Sidebar Savvy

As of OS X 10.3, Apple added something new to the left side of every Finder window: the sidebar. You can activate items in the sidebar with one click, as opposed to the double-click required in a normal Finder window. In its stock form, the sidebar contains useful time-savers, but if you customize it to fit the way you work, it can become a truly useful tool.

Take a look and you’ll see that the sidebar has two halves, separated by a light gray line. (Can’t see the sidebar? Double-click on the small dot located on the left side of your Finder window). The upper half contains icons for your computer; hard drives and partitions; and any connected servers and removable media, such as CDs or your iDisk. You can store pretty much anything you like in the lower half, but by default it contains shortcuts to your main user folders, including Desktop, Documents, Movies, Music, and Pictures. It also contains a shortcut to the systemwide Applications folder.

To make your sidebar more useful, go to the Finder: Preferences menu, select the Sidebar tab, and deselect any of the items you don’t want to see. Alternatively, you can remove shortcuts by dragging their icons off the sidebar and dropping them into the normal Finder window—when you release the mouse button, the shortcut will vanish in a puff of smoke. Don’t worry—only the shortcut gets erased, not the original item. To add something to the sidebar, drag and drop it into position.

You can add anything to the bottom portion, including files, folders, and applications (See bottom screenshot). For example, do you have a particular file you use regularly, such as your Quicken data file or a presentation you reference often? If so, consider giving it a spot on the sidebar. Deeply buried folders are also good candidates. Instead of opening a whole bunch of folders to reach the depths of your filing system, jump to the right spot with one click. Likewise, store frequently used applications in the sidebar, and you won’t have to make a trip to the Dock to activate them.

If you’re choosing between the sidebar and the toolbar, here are a couple of things to keep in mind: The relative size and position of shortcuts in the sidebar will change with the window size, but they will stay put in the toolbar. Shortcuts in the sidebar support pop-open folders, but those in the toolbar do not. You might want to consider keeping your application and document shortcuts in the toolbar, and your folder shortcuts in the sidebar.

For more-advanced sidebar tricks in previous Mac OS X Hints , see the tip on viewing paths when using folders from the sidebar (July 2004); the advice on using a superskinny sidebar (November 2004); and the very cool but very advanced tip on colorizing the sidebar’s background (January 2005).

Trash Images in Flash

Apple’s Preview tool is a useful way to scan and review a bunch of images quickly. Select them all in the Finder, and then drag and drop them onto Preview. The application opens one main window with a side drawer that contains image thumbnails. Click on any thumbnail to view the full-size version. Typically, you might then make note of the ones you don’t want to keep, switch to the Finder, and send the unwanted images to the Trash.

Here’s a time-saver—instead of deleting images from the Finder, delete them right from within Preview. Just drag the image you don’t want directly from the drawer to the Trash. You can drag only one image at a time, but this is still faster than switching to the Finder to get rid of images. You can also drag images to other locations from Preview’s drawer—directly into Photoshop for additional editing, for example, or into other Finder folders to create copies.

Adding an item to the sidebar is easy; simply drag and drop it from a normal Finder window into place. You can store files, folders, and even applications here. When you want to remove an item, just drag it off the sidebar and watch it disappear.With this simple two-line script, you can use Terminal to browse entries quickly on the community-built encyclopedia Web site known as Wikipedia.
1 2 3 Page 2
Page 2 of 3
  
Shop Tech Products at Amazon