[ Printer Friendly Page ]
[ E-mail this Document to Someone ]
[ Was this document useful? Yes or No ]
Infodoc ID |
|
Synopsis |
|
Date |
14641 |
|
Anatomy of a COMMAND Action in CDE |
|
21 Dec 1996 |
An Action Definition has the following syntax :
ACTION <action_name>
{
TYPE <action_type>
<action_field>+
}
where:
<action_name> is the name used to invoke the action
<action_type> is one of three types of Actions:
1) Command actions. A command action executes a command that starts an
application, utility, shell script, or operating system command.
2) Map actions, which is primarily used to specify alternative names
for actions. A map action is "mapped" to another action.
3) TT_MSG actions, which send Tooltalk messages.
<action_field>+ is one or more fields that describe an action's behavior
or look and feel.
Here is an overview of some of the {action_fields} used in
the popular Action Type COMMAND:
WINDOW_TYPE: specifies the type of windowing support required by the action:
- NO_STDIO: No type of windowing support. The action
has its own window or has no output.
- PERM_TERMINAL: a permanent terminal emulator window, which remains
open until the user closes it.
- TERMINAL: a temporary terminal emulator window, which closes as
soon as the command is completed.
EXEC_STRING: the application, shell script or operating system command
that this action is to invoke. There is special syntax that can
be used in case arguments are needed:
- %(File)Arg_{n}%
lets a user drop a data file on the action
where {n} is an integer starting at 1
- %Args%
accepts multiple files, that a user drops on the action
- %(File)"{prompt}"%
displays a prompt for a file name, when the user invokes
the action
where {prompt} is a text string that prompts the user
for a file name
-%(File)Arg_{n}"prompt" combines the two above. It accepts
a dropped file as an argument. Otherwise, it displays
a prompt for a file name
-%(String)"prompt"% prompts for a non-file argument
LABEL: the Action Label seen in CDE's File Manager and Application Manager
ICON: used to specify the icons seen in CDE's File Manager and Application
Manager
For example, an Action that runs a single Unix C shell command is:
ACTION csh_command
{
TYPE COMMAND
WINDOW_TYPE PERM_TERMINAL
EXEC_STRING /usr/bin/csh -c '%(String)"Csh Command: "%'
LABEL One-time C Shell
ICON /usr/dt/appconfig/icons/C/Dtterm.m.pm
}
To make this work from CDE's dtfile, create an empty executable file
called csh_command, and make it executable:
$ touch csh_command
$ chmod 755 csh_command
Then, create a file called $HOME/.dt/types/csh_command, that
has the above action.
Run this command:
$ dtaction ReloadActions
To invoke the action, bring up dtfile, and double-click the csh_command
empty file, previously created.
Top
Sun Proprietary/Confidential: Internal Use Only
Feedback to SunSolve Team