43.1.1 Specifying system commands

To specify a command (or a macro) to execute before or after a document is converted (and optionally compiled and/or archived):

[Automation]
; SystemStartCommand = command line to run at start of processing
; SystemWrapCommand = command line to run at end, before compiling
;  and archiving
; SystemEndCommand = command line to run at end, after compiling
;  and archiving

Use only commands that can run without interaction.

The value you assign to one of the System*Command keywords is an actual Windows system command, just as you would have typed it at a Windows command prompt. For example:

[Automation]
SystemEndCommand = copy /Y G:\MyProj\_wrap\*.xml D:\xml\backups

If you specify a relative path in a system command, that path is considered to be relative to the project directory. For example, the following command renames a file located in the wrap directory (see §44.2 Activating and logging production of deliverables):

[Automation]
SystemEndCommand = rename .\wrap\ugdita2go.htm _ugdita2go.htm

Assign only one command to each keyword; the command must be all one line. If you need multiple commands or multiple lines per keyword, see the following:

§43.1.4 Supplying system commands in a .bat file

§43.1.5 Supplying system commands in a macro.

When you assign a system command (or a macro) to a System*Command, DITA2Go generates one or more lines of code, each of which is a command to be run at a Windows command prompt. DITA2Go writes these lines to a .bat file named for the keyword, saves the file in your project directory, and causes Windows to execute the file.

Use backslashes in file paths

When you specify a file path in a system command, use “\” as the separator character. For example, suppose you want to make a backup copy of your book on another server before you run each conversion, and then copy your result files to another directory:

[Automation]
SystemStartCommand = copy <$$_prjpath>\*.fm x:\backup
SystemEndCommand = copy <$$_currpath>\*.htm \outcopy

Start commands work only when you convert

If your configuration file includes the following setting:

[Automation]
OnlyAuto = Yes

commands assigned to SystemWrapCommand and to SystemEndCommand are executed; however, commands assigned to SystemStartCommand are ignored. When you set OnlyAuto=Yes, you are deploying an existing set of output files, and you do not want that set disturbed; see §44.13 Postprocessing separately from converting.

Previous Topic:  43.1 Executing operating-system commands

Next Topic:  43.1.2 Including macros and variables in system commands

Parent Topic:  43.1 Executing operating-system commands

Sibling Topics:

43.1.2 Including macros and variables in system commands

43.1.3 Monitoring system command execution

43.1.4 Supplying system commands in a .bat file

43.1.5 Supplying system commands in a macro