Chapter 7 - Running Programs

Previous Chapter : Next Chapter : Top


Table of Contents



In this chapter, you will learn how to use the Desktop to run and terminate programs from:

You will also learn how to:


Activating Files

When you activate a file, the Desktop decides what type of file it is and runs the correct program. When the Desktop runs a program, the program's icon and process ID are displayed in the Jobs Window. (Select Jobs... from the Windows Menu in the Desktop Window to open the Jobs Window.)

You can usually terminate a program started from the Desktop with the Request Job Termination or Force Job Termination commands from the Jobs Menu in the Jobs Window if it is open.

For information on defining the system-wide actions, refer to Chapter 11, "Defining File Types." Note that you must be a super-user or system administrator to update these rules.

There are three ways to activate a file in the Desktop:

Activating Files by Double-Clicking

  1. In a Directory Window or the Desktop Window, double-click the file you want to activate.
    If there are no actions associated with the file, the Desktop displays a dialog telling you this.
    If there are actions associated with the file, the file is activated, and the Desktop displays the icon for the default program associated with the file in the Jobs Window.

Activating Files by Dragging and Dropping

You can also activate a file by dropping it onto a drop receiver. Drop receivers are file types that have special rules defined that enable them to run programs when files are dropped onto them.

An example of a drop receiver would be a text editor. To run the program and edit a document, you could drag and drop the document icon onto the word processor icon.

Drop receivers are displayed as icons with bold corner brackets.

  1. In a Directory Window or the Desktop Window, select the file you want to activate (you can also select multiple files).

  2. Drag the file(s) to the drop receiver.

    If there are no actions for the drop receiver associated with the selected file or any one of multiple files, the Desktop displays the "bad drop" cursor, and an "X" is displayed on the drop receiver.

    If there are actions for the drop receiver file associated with the selected file or for all files selected, the Desktop displays the "good drop" cursor and highlights the drop receiver.

  3. Release the mouse button to drop the file(s) on the drop receiver.
    The Desktop runs the appropriate programs and displays the icons for the programs associated with the drop receiver in the Jobs Window.

Activating Files Using the Open Command

  1. In a Directory Window or the Desktop Window, select the file(s) you want to activate.

  2. Choose Open from the File Menu.
    If there are no actions associated with a file, the Desktop displays a dialog telling you this.
    If there are actions associated with the file, the file is activated and the Desktop displays the icon for the default program associated with the file in the Jobs Window.

Viewing and Selecting File Actions

Some files have more than one action associated with them. The action that occurs when you double-click a file (or select it and choose Open from the File menu) is called its default action. the Desktop lets you view all the possible actions for a file and activate one. If you are not sure what a file's default action is, you should view the possible actions before activating it. Selecting an action from the list of possible actions has no lasting effect---the default action for the file does not change.

Selecting File Actions Using the Pop-up Menu

  1. Move the cursor to the file.

  2. Press the Menu button on your mouse (usually the right-most button).
    If there are actions associated with the file, the pop-up menu shows the list of possible actions for the file. The default action is listed first.
    If there are no actions associated with the file, Edit File Actions... appears as the only menu item.

  3. Select the file action you want to run.

Viewing and Selecting File Actions in the File Actions Window

  1. Use the pop-up menu and select Edit File Actions... from the menu.
    You can also Ctrl+double-click the file.
    The File Actions Window opens:

    If there are no actions associated with the file, the Description List, Description, and Command Line sections are empty.
    If there are actions associated with the file, the Description List section contains descriptions of all the possible actions. The default action for the file is highlighted and listed first. It is described in the Description section, and the associated command is displayed in the Command Line section.

  2. Double-click the file action you want to run in the Description List scrolling list.

Customizing File Actions

Initial file actions are determined by the system rulebase, controlled by the system administrator. However, the Desktop lets you create and edit user-specific file actions for individual files or for all files of a particular type.

The File Actions Window is used to enter these file actions and saves them to your custom rulebase. Customizing file actions for your own use does not affect the system's rulebase. (You always have the option to restore the system rulebase file actions.)

Using the File Actions Window to Edit File Actions

The File Actions Window lets you:

There are several symbols that you can use in defining file actions for the Desktop, in addition to those that may be used by your shell. The special Desktop symbols are described in the following table.

Table 7. Values of symbols used in the Command Line Window

-------------------------------------------------------------------------------------
This option:     Inserts this   With this value:                                       
                 symbol:                                                               
-------------------------------------------------------------------------------------
Selected Files   #f             The names of all the files currently selected in the   
                                Directory Window or on the Desktop.                    

                 #F             The full pathnames of all currently selected files.    

Selected         #d             The names of all the directories currently selected    
Directories                     in the Directory Window or on the Desktop.             

                 #D             The full pathnames of all currently selected directo   
                                ries.                                                  

Effective User   #u             The current user name.                                 

Effective Group  #g             The group name associated with the Desktop pro         
                                cess.                                                  

Current          #c             The full pathname of the current directory, or the     
Directory                       user's home directory if running from the Desktop      
                                Window rather than a Directory Window.                 
                                This current directory appears as the title of the     
                                Command Line Window.                                   

Drop Receiver    #r             The name of the drop receiver associated with cur      
                                rently selected files.                                 

                 #R             The full pathname of the drop receiver associated      
                                with currently selected files.                         
-------------------------------------------------------------------------------------

Editing File Actions

  1. Use the right-click menu on any object to open the Edit File Actions Window.

  2. Select one of the following Rule Types:

  3. Select the file action you want to edit in the Description List.

  4. In the Command Type section, make the appropriate selection.
    All file actions that exist or are created in the custom rulebase are editable unless they are the Default Text Editor or Default Data Editor.
    If you select Default Text Editor or Default Data Editor (set as Execution Preferences) you cannot edit a file action in the Description List.
    If you have not listed any text or data editors for file actions, selecting Default Text Editor or Default Data Editor automatically enters the appropriate editor as "preferred" in the Description List.

  5. In the Description text box, make any needed changes to the description of the file action.

  6. In the Command Line text box, make any needed changes to the command for the file action.
    The contents of this field are passed to the operating system shell when this action is selected.
    Your command can contain any text or symbols allowed by your operating system shell, including environment variables. In addition, you can embed the Desktop special symbols in the command. The table above lists the Desktop special symbols.

  7. Select or unselect the Run Command In New Terminal Emulator Window check box.
    This check box is located below the Command Line text box. When activated, it runs the command for a file action in a new terminal window.

  8. In the Apply To field, select either Current File or File Type.
    This restricts a file action to the selected file only or all files of the same type (as displayed in the File Type field at the top of the window).

  9. Click OK to update your custom rulebase and exit the File Actions Window.
    You can also click Apply to save your changes without closing the window, or Reset to discard any changes you made since your custom rulebase was last saved.
    You can click Defaults to reset your rulebase to the system rulebase. If the rule you are deleting is a custom rule that applies to a specific file, and a custom rule also exists for that file type, the per-file rule is discarded and the custom file type rule now applies.

Creating File Actions

  1. Use the right-click menu on any object to open the Edit File Actions Window.

  2. Select one of the following Rule Types:

  3. Click New in the List Actions section.
    A new, blank entry appears at the top (default action line) of the Description List.
    The Command Type section displays the file action as editable.

  4. In the Command Type section, make the appropriate selection.
    All file actions that exist or are created in the custom rulebase are editable unless they are the Default Text Editor or Default Data Editor.
    Selecting the Default Text Editor or the Default Data Editor (set in the Preferences Window) overrides any file actions in the Description List.
    If you have not listed any text or data editors for file actions, selecting the Default Text Editor or Default Data Editor automatically enters them as "preferred" in the Description List.

  5. In the Description text box, enter text for your description of the file action.

  6. In the Command Line text box, enter text for the command associated with the file action.
    The contents of this field are passed to the operating system shell when this action is selected.
    Your command can contain any text or symbols allowed by your operating system shell, including environment variables. In addition, you can embed the Desktop special symbols in the command. For a list of the Desktop special symbols, refer to Table 7.

  7. Select or unselect the Run Command In New Terminal Emulator Window check box.
    This check box is located below the Command Line text box. When activated, it runs the command for a file action in a new terminal window.

  8. In the Apply To field, select either Current File or File Type.
    The Apply To field lets you restrict a file action to the selected file only or all files of the same type (as displayed in the File Name field at the top of the window).

  9. Click OK to update your custom rulebase and exit the File Actions Window.
    You can also click Apply to save your changes without closing the window, or Reset to discard any changes you made since your custom rulebase was last saved.
    You can click Defaults to reset your rulebase to the system rulebase. If the rule you are deleting is a custom rule that applies to a specific file, and a custom rule also exists for that file type, the per-file rule is discarded and the custom file type rule now applies.

Trying Out File Actions

The File Actions Window lets you try out a file action. You can try out any file action in the File Actions Window's Description List; however, this function is provided to allow users to try out file actions before saving them as part of their custom rulebase. You may have to edit a file action before you save it to your custom rulebase if the behavior is not what you want when you try it out.

  1. In the Description List, select the file action you want to try out.

  2. Click Try Out from the List Actions section.
    The file action is activated.

  3. Click OK to update your custom rulebase and exit the File Actions Window.
    You can also click Apply to save your changes without closing the window, or Reset to discard any changes you made since your custom rulebase was last saved.
    You can click Defaults to reset your rulebase to the system rulebase. If the rule you are deleting is a custom rule that applies to a specific file, and a custom rule also exists for that file type, the per-file rule is discarded and the custom file type rule now applies.

Changing the Default Primary Action

  1. In the Description List, select the file action you want to make the default action.

  2. Click Make Default in the List Actions field.
    The selected file action moves to the top of the Description List and becomes the default file action.

  3. Click OK to update your custom rulebase and exit the File Actions Window.
    You can also click Apply to save your changes without closing the window, or Reset to discard any changes you made since your custom rulebase was last saved.
    You can click Defaults to reset your rulebase to the system rulebase. If the rule you are deleting is a custom rule that applies to a specific file, and a custom rule also exists for that file type, the per-file rule is discarded and the custom file type rule now applies.
    Selecting a file action in the Description List and dragging it to the top of the list makes it the default file action.

Removing File Actions

  1. In the Description List, select the file action you want to delete.

  2. Click Remove in the List Actions field.
    The selected file action is deleted from the Description List. The default file action is highlighted.

  3. Click OK to update your custom rulebase and exit the File Actions Window.
    You can also click Apply to save your changes without closing the window, or Reset to discard any changes you made since your custom rulebase was last saved.
    You can click Defaults to reset your rulebase to the system rulebase. If the rule you are deleting is a custom rule that applies to a specific file, and a custom rule also exists for that file type, the per-file rule is discarded and the custom file type rule now applies.

Terminating Jobs

When you run a program from the Desktop, you normally exit it from within the program itself using the appropriate command. However, sometimes a program "hangs" or malfunctions so that you cannot terminate it normally. If this happens, the Desktop gives you a simple way to terminate the program.

Make sure that when you terminate a program, it is really hung, not simply waiting.

Job is a general term for a running program. There are two ways to terminate most jobs launched from the Desktop:

The Request Job Termination command sends a message to the job asking it to terminate. This command gives the program a chance to clean up and exit. The Force Job Termination command forces the job to terminate as soon as possible.

If you try to terminate a job with the Request Job Termination command and it does not terminate, use the Force Job Termination command. If you have difficulty terminating a job with the Force Job Termination command, see your system administrator.

Terminating a Job

  1. Open the Jobs Window from the Windows Menu on the Desktop.

  2. In the Jobs Window, select the icons for the jobs you want to terminate.

  3. Choose Request Job Termination or Force Job Termination from the Jobs Menu in the Jobs Window.
    The jobs are terminated and the icons are removed from the Jobs Window.
    A message alert is displayed to tell you if a job does not terminate.

Using the Command Line Window

The Command Line Window simplifies the task of running operating system commands from a shell by:

The current directory reference, which appears in the title of the Command Line Window, is significant when using the special symbols #f and #d. These two symbols refer to the names of all selected files or directories (respectively) in the current directory. Therefore, #f or #d used in a Command Line Window run from the Desktop refer to any selected files or directories on the Desktop that are located in the user's home directory only. It is recommended that #f and #d be avoided in commands referencing the Desktop (they are disabled in the Symbols Menu). Use #F and #D instead.

If a command includes any special Desktop symbols, make sure that you do not run it from a different Directory Window than the one with the current selection. Otherwise, you may get unexpected results. You should open the Command Line Window from the same directory in which you have selected items to operate on.

Running Commands

  1. Choose Command Line... from the Run Menu in any Directory Window or the Desktop Window.
    The Command Line Window opens:

    If you select Command Line from a Directory Window, the current directory reference, which appears as the title of the window, is the directory displayed in the Directory Window.
    If you select Command Line from the Run Menu in the Desktop Window or from the Icon Bar, the current directory reference, which appears as the title of the window, is your home directory.

  2. Type your command in the Command Line text box, or select a command you have already run from the History List.
    If you select a command from the History List, you can edit it before running it.
    Your command can contain any text or symbols allowed by your operating system shell, including environment variables. In addition, you can embed the Desktop special symbols in the command, either by typing the symbol or by putting the text insertion cursor where you want the symbol and selecting the corresponding option from the Symbols Menu.
    Refer to Table 7 for a description of the values in the special Symbols Menu that you can use in the Command Line Window.

  3. If you want the program to run in a terminal emulator window, click the Run In Terminal Window check box.

  4. If you want to be sure you will be able to read the output when the program finishes, click the Pause After Execution check box.
    If you select the Pause After Execution button and the command is not running in a terminal emulator window, you may have to use the Request Job Termination command in the Jobs Window to terminate the program.

  5. Click Run to execute the command.

  6. Click Close to close the Command Line Window.

A Command Line Window Example

The following example demonstrates the use of special symbols in the Command Line Window. Suppose you want to use the standard system utility wc to count the number of lines in three text files named report1, report2, and report3. To do this from a standard command-line shell, you need to type:

wc -l report1 report2 report3

The -l argument tells the wc command to count lines.

Using the special symbol #f (the Selected Files option in the Symbols Menu), you would select the files in a Directory Window and then type:

wc -l #f

in the Command Line field of the Command Line Window. When you run the command, the #f symbol in this command line is replaced by the names of the selected files, resulting in the command wc -l report1 report2 report3. This saves you the trouble of typing the file names.

Once you have run this command, it is stored in the History List with the #f in the text of the command, not the specific file names. To run the same command again on a different set of files, you can select those files and then select the command from the History List.

For more information on using the commands and utilities available on your system, refer to the system documentation or see your system administrator.

Removing Commands from the History List

You can remove any command from the History List in the Command Line Window.

  1. Choose Command Line... from the Run Menu in any Directory Window or the Desktop Window.
    The Command Line Window opens.

  2. Select the command you want to remove in the History List.

  3. Click Remove.
    The command is removed from the History List.

Displaying a Terminal Window

The Desktop lets you use a command-line shell in a terminal emulator window. Once you have displayed a terminal emulator window, you can enter shell commands to run programs, just as if you were logged in at a character-based terminal. The Desktop does not limit the number of terminal emulator windows you can have open.

  1. Choose Terminal Emulator from the Run Menu in any Directory Window or the Desktop Window.
    A terminal emulator window is displayed on your workspace.
    If you display a terminal emulator window from a Directory Window, the current directory is the one displayed in the Directory Window.
    If you display a terminal emulator window from the Run Menu in the Desktop Window or from the Icon Bar, the current directory is your home directory.

With Execution Preferences, you can specify both the terminal emulator program and your command-line shell.

For more information about specifying your default terminal emulator program or a shell, refer to "Changing Execution Preferences."