What types of items can be launched or opened?
The Command Window can launch or open many different types of files (see Introduction to the Command Window for an explanation of the general command syntax). As a general rule, any item that launches an application when the icon is double-clicked in the Finder can be launched or opened by the Command Window.
For example, the Command Window can handle the following tasks:
- Launching applications
- Opening files
- Opening recent files and folders (via the Finder)
- Launching (running) Applescripts or Unix shell scripts
- Launching individual Preference Panes
- Launching an internet bookmark in a web browser
Launching or Opening items
There are default actions for different types of item, but you can choose other actions by pressing Tab to select the second field, where the Results Window listing the other actions will pop up. If you have set the 'Show other matches' item of the Matching Preferences to 'Never', you need to press the down arrow to show the Results Window. To select an action, navigate to it using the up or down arrows and then press enter to select it. Alternatively, you can use the mouse to click an action directly. Once you become familiar with the actions, you might prefer to select the one you need directly by typing some of the characters in its name, in the same way that you select an item in the first field (see Browsing Results for more details).
The following actions are available for opening files or folders, or launching applications (some are only available if you have Beta or Alpha features selected - see Application Preferences):
- Launch - launch the item (this is the default for applications).
- Open - open the item with the default application (this is the default for files or folders).
- Open With… - launch the item using another application that you specify in the next field (this doesn't make much sense for applications).
- Open File… - this action is only available when the selected item is an application. It is effectively the reverse of 'Open With…'. When you select an application as the first item, then the action 'Open File…', you can open the file you select as the third item with the application you initially selected (this sounds a lot more complicated than it really is). This will probably save you a bit of time over opening an application and then finding and opening the file from within the application itself.
Opening recent items
You can set the Catalog to scan Recent Applications, Documents, Servers, Favourites, and Recent Folders (from the Finder or the Open & Save dialogs), so that those items will be available for searching in the usual way. This gives the Command Window the rather spooky ability to know what you are currently working on and find that item quickly.
Running scripts
If you select an item which is an executable script, the default action is 'Run' (for Applescripts), or 'Run Shell Script' (for Unix shell scripts such as Bash, Perl or Python). This is a very handy way to run scripts without resorting to Terminal or mousing over to the Applescript menu in the menubar. Of course, most of the other file and application actions are also available, so you can edit the script in Script Editor, or email it to a friend.
You can also run Unix commands from the Command Window, and even pass arguments to Unix commands or shell scripts. To do this you need the Terminal plug-in.
If you want to run a Unix command, you need to make sure that the commands you want access to are scanned in the Catalog. Since Unix paths (like /bin and /usr/bin) are not shown in Finder, you can't select the path to the Source in the Catalog using the normal method (see Catalog). However, there is a trick to allow you to do it. Click the '+' button at the bottom of the Catalog window to create a new source. For now, select any folder in the Open dialog. Open the information drawer for the new item by clicking the 'i' button. Choose “Source Options” from the drop-down menu. The panel directly below the label “Path” shows the path of your Source, but what isn't obvious is that this path is editable. Click in the panel, type the path you require (for example, /usr/bin) and press Tab to enter the path.
Now you can access Unix commands in the Command Window:
- Activate the Command Window, type a shortcut to find the command (for example,
topto find/usr/bin/top, and press Return or Enter. - A new Terminal window opens running your command.
To pass arguments to a shell script or Unix command:
- Activate the Command Window, and type a shortcut to find a shell script or Unix command (see previous steps).
- Press Tab and choose
Run [with arguments]. - Press Tab again, then enter text mode and enter your arguments in the text box in the third field.
- Quicksilver executes your command, and places the output in a text clipping in the first field for you to do with as you wish.
Command-line devotees will immediately be able to see the amazing potential of this feature. One word of warning though; don't try to use Run [with arguments] on an interactive command that doesn't exit until you tell it to. For example, if you pass arguments to top in this way, it will output the first lines to a text clipping and then hang waiting for input, so that you will have to kill the process manually. Remember - always practice safe command-line techniques.
Opening Preference Panes
There is a Catalog Source item to scan Preference Panes (System > Configuration > Preference Panes), so you can search for a particular Pane (such as Displays) to open it directly.
Opening bookmarks
Another Catalog Source item for internet bookmarks (Internet > Bookmarks) gives you lightning-fast access to your bookmarks (the presets can scan Safari, Omniweb or Internet Explorer bookmarks). Just type in an a few letters of the bookmark and hit return (the default action is 'Open'), and the bookmarked site will be opened in your browser.