# Create Action Tasks

## Creating and Editing Actions

1. - ToCreateAction

   - ToEditAction

## Creating and Editing Data Types

1. - ToCreateAction

   - ToEditDatatype

## Icons for Actions and Data Types

1. - ToSpecifyIcon

## To Create an Action With Create Action

1. Open the Desktop_Apps application group in Application Manager and double-click Create Action.

   This displays the Create Action main window.

2. In the Action Name text field, type the name that will label the action's icon.

   The action name can include any characters except spaces.

3. Use the Action Icons controls to specify the icon for the application. Initially, the default icon is shown.

   - To use a different existing icon, click Find Set to open the Find Set dialog box. For more information, see ToSpecifyIcon.

   - To create new icons, click Edit Icon to run the Icon Editor. See CreatingNewIcon.

4. In the Command When Action Icon is Opened text field, type the command to start the application.

   Use the syntax `$n` for a file argument. For example:

       emacs
       bitmap $1
       diff $1 $2
       lp -oraw $1

   If the command line includes a file argument (`$n`), then the action icon will be a drop zone for files.

   The command lines are not passed to a shell unless you explicitly specify the use of a shell. For example, these lines use shell processing:

       /bin/sh -c `ps | lp'
       /bin/sh -c `spell $1 | more'

5. In the Help Text for Action Icon text field, type the help information to be displayed when the user gets on-item help on the action icon.

   The text will automatically wrap in the text field. However, these line breaks are not preserved online. If you want to specify a "hard" line break, use `\n`.

6. Use the Window Type button menu to select the kind of windowing support required

   Graphical (X-Window)

7. The application creates its own window.

Terminal (Auto-Close)

- The application will be run in a terminal window that closes automatically when the user exits the application.

Terminal (Manual Close)

- The application will be run in a terminal window that remains open until the user explicitly closes it.

No Output

- The application does not produce output to the display.

- Proceed as follows:

  - If your application has data files and you want to create one or more data types for them, see ToCreateDatatype.

  - If you do not need to create a data type:

    1. Save the action by choosing Save from the File menu.

    2. Test the new action by double-clicking its icon in your home directory.

## To Create a Data Type with Create Action

1. Define the action for the application. See steps 1 through 6 of the topic ToCreateAction.

2. Click the Advanced button to expand the Create Action window.

3. If you want the action icon to prompt for a file argument when the icon is double-clicked, type the text of the prompt into the "When Action Opens, Ask Users for" text field.

   - You must use this field if the application's command line has a required file argument.

   - You must leave this field blank if the application's command line does not have a file argument.

   - If the file argument in the application's command line is optional, you have a choice. If you supply the prompt text, the action icon will prompt for the file when double-clicked. If you do not supply the prompt text, the action will be executed with a null string as the file argument.

4. Specify the types of files that the action will accept as arguments:

   - If the action can accept any data type, click All Datatypes.

   - If the action can accept only the data type(s) you create for the application, click Only Above List.

   Initially, the Datatypes That use This Action list is empty. As you create data types for the application, they are added to the list.

5. Click Add to display the Add Datatype dialog box.

6. Optional: If you don't want to use the default data type name, type a new name for the new data type into the Name of Datatype text field. The name cannot include spaces.

7. Click the Edit button beside the Identifying Characteristics box to display the Identifying Characteristics dialog box.

   Use this dialog box to set the characteristics used to differentiate the data type from others. You can choose one criterion (for example, Name Pattern) or combine criteria (for example, both Name and Permission Patterns).

   1. Click either the File or Folder toggle button to specify whether the data type presents a file or a folder.

   2. If the data type depends on the name, click the Name Pattern check box and type the name pattern. You can use `*` and `?` as wildcards.

      *

   3. Matches any sequence of characters.

?

- Matches any single character.

- If the data type depends on the permissions, click the Permission Pattern check box and click the permissions required for the data type.

  On

- The file must have the specified permission.

Off

- The file must lack the specified permission.

Either

- (Default) The permission does not matter.

- If the data type depends on the contents, click the Contents check box and supply the requested information-Pattern to search for and Type of contents. Optionally, you can supply the byte location where the search should start.

- Click OK to close the File Characteristics dialog box.

  The characteristics will be displayed in the Identifying Characteristics box in the Add Datatype dialog box.

  The Permissions information in the Identifying Characteristics box uses this coding:

  d

- Directory

r

- Read permission

w

- Write permission

x

- Executable

!

- NOT

&

- AND

- Type the help text for the data type into the Help Text text field

- Use the Datatype Icons controls to specify the icon for the application.

  Initially, the default icons are shown.

  - To use a different existing icon, click Find Set to open the Find Set dialog box. For more information, see ToSpecifyIcon.

  - To create new icons, click Edit Icon to run the Icon Editor. See CreatingNewIcon.

- Optional: If the application supplies a print command for printing data files from the command line, type the command into the Print Command text field, using the syntax `$n` for a file argument.

- Click OK to close the Add Datatype dialog box and add the data type to the data types list in the Create Action window.

## To Specify Icons for Actions and Data Types

The Create Action Main window and Add Datatype dialog box contain buttons for specifying the icon to be used by actions and data types.

- To use an existing icon, click Find Set. See ToSpecifyIcon.

- To create a new icon using Icon Editor, click Edit Icon. See CreatingNewIcon.

### To Use the Find Set Dialog Box

The Find Set dialog box is displayed when you click Find Set in the Create Action main window or in the Create Datatype dialog box.

The Find Set dialog box lets you specify:

- An icon located in a folder in the Icons Folders list. The Icon Folders list includes all the folders on the icon search path.

- An icon that is part of a registration package that will be integrated with the desktop using `dtappintegrate`.

### To Specify an Icon in an Icon Folder

1. 1. In the Icon Folders list, double-click the folder path containing the icon.

      The Icon Files list will show all the icon files in that folder.

   2. In the Icon Files list, click the icon you want to use.

   3. Click OK.

### To Specify an Icon in a Registration Package

1. If you are a system administrator or programmer creating a registration package, the icon image files are initially located in a directory in the registration package:

       app_root/dt/appconfig/icons/language

   After registration, the icon files will be in an icon folder. Therefore, the action and data type definitions should use the base file name.

   Use this procedure to specify a base name for an icon that is not currently in an icon folder:

   1. In the Enter Icon Filename text box, type the base name of the icon file.

   2. Click OK.

      An error dialog box is displayed, informing you that the icon file wasn't found in an icon folder.

   3. In the error dialog box, click Name OK. This closes the dialog box and the Find Set dialog box.

   4. Ignore the absence of an icon image in the Action Icons or Datatype icons field. The icon image will be found when the application has been registered.

### Creating a New Icon Image

1. Click Edit Icon in the Create Action or Edit Datatype window. This runs Icon Editor.

2. Use Icon Editor to draw a new icon. See:

   - Icon Editor Tasks.

   - IconSizesandNames

3. Choose Save from the File menu to save the icon file.

   Save the icon file into the `HomeFolder/.dt/icons` folder. See IconSizesandNames.

If you are a system administrator or applications programmer creating a registration package, the icon file should be saved to the `approot/dt/appconfig/icons/language` directory.

### Icon Sizes and Names

Desktop icons use this naming convention:

Size (Pixels)

- Name

32 by 32

- `basename.m.pm` or `basename.m.bm`

16 by 16

- `basename.s.pm` or `basename.s.bm`

- For action icons, use the action name as the basename.

- For data type icons, use the data type name as the base name.

## To Edit an Existing Action

You can use Create Action to edit an existing action if:

- The action was created with Create Action.

- And, the the file containing the action definition has not been edited manually (using a text editor).

1. Open the Desktop_Apps application group in Application Manager and double-click Create Action.

   This displays the main Create Action window.

2. Choose Open from the File menu. This displays the Open dialog box.

3. In the Files list, select the file containing the action definition. It has the name `action_name.dt`.

4. Choose OK.

## To Edit an Existing Data Type

You can use Create Action to edit an existing data type if:

- The data type was created with Create Action.

- And, the file containin the data type has not been edited manually (using a text editor).

1. Open the Desktop_Apps application group in Application Manager and double-click Create Action.

   This displays the main Create Action window.

2. Choose Open from the File menu. This displays the Open dialog box.

3. In the Files list, double-click the file containing the data type definition.

   The name of the file is `action_name.dt`, where action_name is the name of the action that was created at the same time you created the data type.

4. Click Advanced.

5. In the Data Types That Use This Action list, select the data type to be edited.

6. Click Edit to open the Edit Datatype dialog box.

7. Make changes in the Edit Datatype dialog box. When you are done, click OK.

8. To save the edited definition, choose Save from the File menu.