Output to multiple formats

Navigation:  More Advanced Procedures > Command Line Options >

Output to multiple formats

Previous pageReturn to chapter overviewNext page

Show/Hide Hidden Text

You can generate output to multiple formats with the command line, either by calling publishing tasks defined in the Task Manager or by defining the output formats directly.  You can also achieve this with multiple command lines stored and executed with INI and batch files.

Syntax for executing publishing tasks in the command line:

HELPMAN.EXE <path>\projectfile.hmxz /TSK="taskname:actionname" /TSK="taskname:actionname"...

Syntax for selecting multiple formats directly in the command line:

HELPMAN.EXE <path>\projectfile.hmxz /<format1> /<switches> /<format2> /<switches> ...

Each format switch must be directly followed by all the switches you want to apply to that format. Each format must have its own set of switches, they are not applied to multiple formats.

Click to expand/collapseUsing publishing tasks in the command line

The easiest way to publish to multiple output formats from the command line is to call predefined publishing tasks created with the Publishing Task Manager using the /TSK= switch. See Publishing Tasks - Automation for full instructions on using the Task Manager.

Technically, it is possible to include the /TSK= switch as just one switch among many in a single command line. However, there is no real benefit to this and it makes your batch files more difficult to read and debug.

Unlike other switches, the /TSK= switch can be used on its own. All you need is HM Program + Project File + /TSK. For clarity, it is really better to call this switch on its own on a single command line.

The switch can be used in INI files in the same way as other switches. Just use the syntax:

TSK=taskname:actionname

As always with INI files, don't use any quotes around the components of the line.

You can generate command lines for single and multiple actions from the Task Manager. Just select the actions in a task, the select the Generate Publish Batch File option to create a batch file. You can the copy the command line from that file to use it in your own manually-created batch files.

Although it is possible to mix the /TSK= switch with other switches it is easier to manage if you call publishing tasks on individual lines of their own. Unlike other switches, all you need for this switch is the HELPMAN.EXE filename, the project filename and the /TSK= switch with the task and action names.

Publishing all the actions in a task:

To publish all the actions in a task just include the task name on its own, like this:

HELPMAN.EXE D:\Projects\widgets.hmxp /TSK="Daily Build"

Publishing single actions in a task:

To publish a single actions in a task add the name of the action after the name of the task, separated by a colon (:) character:

HELPMAN.EXE D:\Projects\widgets.hmxp /TSK="Daily Build:Full CHM Output"

Publishing multiple selected actions in a task:

To publish a multiple (but not all) actions in a task use the /TSK= switch multiple times, once for each action. Alternatively, you can also write separate command lines for each action if you like. The result will be the same.

HELPMAN.EXE D:\Projects\widgets.hmxp /TSK="Daily Build:Full CHM Output" /TSK="Daily Build:Full HTML Output"

Click to expand/collapseSwitches reference for multiple format output

Local and Global Switches for Multiple Output

Local switches

The following switches are "local". They must be applied to each output format individually by inserting them after the format switch for which they should apply and before the next format switch.

/I=<include options>The include options you want to use for the output format.
/Template=<template>The PDF template to be used for PDF output (only for PDF output).
/V=<filename>This switch specifies an external file to redefine the values of variables in your project file. Can be used multiple times per output format, the last file called has priority.
/O=<filename>This switch specifies an external .hmskin HTML skin file to apply to your output. Can be used multiple times per output format, the last skin file called has priority.
/S=completeOnly output topics with the status "complete".

Global switches

These switches can only be used once per command line and they apply from the point in the command line at which they are inserted.

/keeptempDoesn't delete the temporary directories and source files generated for HTML Help, Visual Studio Help and Apple iBooks®/ePub output.
/E=<compiler log file>Outputs the compiler log to the specified file.
/debugDisplays debug information for each output format before publishing.

If you have multiple output formats in a single command line you must insert these switches directly after the first output format to apply them to all output formats. To apply them only to  some output formats insert the switches after the first output format for which you wish them to apply.

Examples:

1) helpman.exe project.hmxz /CHM /keeptemp /EPUB

2) helpman.exe project.hmxp /CHM /EPUB /keeptemp

Example 1) above keeps the temporary files for both the CHM and EPUB output. Example 2) only keeps the temporary files for the CHM output. The same applies for log files and debug information.

See Syntax reference for more information on the individual switches and parameters.

Click to expand/collapseMultiple output format command line examples

Example 1:

The following example compiles a project file to HTML Help and PDF, using conditional output include options for the HTML Help file and selecting a specific PDF print manual template for the PDF output file. The template is assumed to be in the project directory; if it is stored somewhere else you must include its path.

HELPMAN.EXE D:\Projects\widget.hmxz /CHM=widgethelp.chm /I=CHM,DEMO /PDF=manual.pdf /Template=manual.mnl

Example 2:

The following example compiles to CHM and WebHelp using include options.

HELPMAN.EXE D:\Projects\widget.hmxp /CHM=D:\CHM\widget.chm /I=CHM,FINAL /HTML=D:\HTML\index.html /I=HTML,FINAL

See also:

.INI and batch files