The pre-command and post-command properties
can contain programming code for commands to be executed before and
after the document publishing process.
About this task
You might use the
post-command property
to copy the output files, archive the output files, rename the output
files based on variables, mail the output files, or invoke third party
applications. Refer to the documentation for your operating system
to learn more about the commands you can use. Example:
Microsoft Windows Command-line reference
Procedure
- In the Document Specification view,
click Metadata. The Properties view
is displayed.
- Select the pre-command or post-command property
and click the Configuration icon
. The Set values for pre-command
or post-command window opens.
- Enter the values. You can use system variables,
such as RPE_HOME, or external template variables
in your commands. The format is always ${variable}.
Template variables take precedence over system variables when they
have the same name. You can also use the output formats as variables
to indicate the path specified in the output
properties. You must write the variable as its name is displayed in
the document specification. Examples:
- ${RPE_HOME}
- ${Html}
- ${Word}
- ${PDF}
- ${New PDF}
- ${XslFo}
- ${ModuleName}
Note: You cannot use any variations to these names, like ${WORD} or ${word}.
These variations cannot be recognized by Rational® Publishing Engine.
For
example, only the variable ${Word} inserts the path property
value specified for the Microsoft Word
output. In the log, the variable displays as the value.
- Optional: For the stop on pre-command
failure property, enter true or false. When set to true, and the pre-command
fails, then the document generation stops running. When set to false or
no value is entered, and the pre-command fails, then the document
generation continues running.
- Click OK.
Example

To copy the output to a second location, use the following
command:
cmd /c copy ${output_format} D:\path\filename.output_extension
When
writing commands in JavaScript,
enter
//!JavaScript to the beginning of the code
to use the internal JavaScript engine
to evaluate the commands:
//!JavaScript
var x = output;
var y = variable;
java.lang.System.out.println( "X+Y=" + x + y);
1;