The desktop provides the dtaction command for running actions from a command line. You can use dtaction to run actions from:
Scripts
Other actions
A terminal emulator command line
dtaction [-user user_name] [-execHost hostname] \ action_name [argument [argument]…]
-user user_name—provides the ability to run the action as a different user. If dtaction is invoked by a user other than user_name, a prompt is displayed for the password.
-execHost hostname—for COMMAND actions only; specifies the host on which the command will be run.
argument—arguments to the action; usually file arguments.
The dtaction client has additional command-line options. For more information, see the dtaction(1) man page.
Use dtaction in the EXEC_STRING of the action.
For example, the following action uses a built-in action named Spell (the action is labeled ``Check Spelling'' in Application Manager). The new action runs Text Editor and the Spell action, displaying the spelling errors in a separate terminal emulator window.
ACTION EditAndSpell { WINDOW_TYPE NO_STDIO EXEC_STRING /bin/sh -c 'dtaction Spell \ %Arg_1"File:"%; dtpad %Arg_1%' }
Use the following syntax in the EXEC_STRING:
EXEC_STRING dtaction -user user_name action_name [file_argument]
The new user (user_name) must have display access to the system through one of the following mechanisms:
Read permission on the login user's .Xauthority file
Or, xhost permission
For example, the following two actions provide the ability to become root and edit an app-defaults file.
ACTION AppDefaults { WINDOW_TYPE NO_STDIO EXEC_STRING /usr/dt/bin/dtaction -user root \ EditAppDefaults %Arg_1"File:"% } ACTION EditAppDefaults { WINDOW_TYPE TERMINAL EXEC_STRING /bin/sh -c 'chmod +w %Arg_1%; \ vi %Arg_1%; chmod -w %Arg_1%' }