Publisher and Web Interface > Publisher > Generating documents and Publisher HTML > Using the command line interface to generate documents and Publisher HTML (Publisher)
  
Using the command line interface to generate documents and Publisher HTML (Publisher)
The Publisher command line interface allows you to generate output through batch files. This is useful, for example, should you want to schedule a batch file to generate output from models overnight.
The command line interface uses the ArtisanPublisher.exe application to generate output. If you have installed Modeler to the default location, the path of the ArtisanPublisher.exe application is as follows.
For 64-bit versions of Windows:
C:\Program Files (x86)\PTC Integrity
Modeler\Modeler\Exe\Publisher\ArtisanPublisher.exe
For 32-bit versions of Windows:
C:\Program Files\PTC Integrity
Modeler\Modeler\Exe\Publisher\ArtisanPublisher.exe
Notes:
The command line interface is not case sensitive.
If there is an error in the command line, see the CommandError.log file that is generated to the %AppData%\Artisan Software Tools\Publisher\Commandline folder. Note that if the /ul argument is included, the name of the CommandError.log file will include date and time information.
Important:
When using Publisher, the Publication Model is usually set to '\Active Model', that is, the active model in Modeler. When using the command line interface, we recommend that you specify the model you want to use through the /pm argument. If you want to always generate output from the latest trunk version of a model, delete the model version information from the model reference, for example, change this:
\\SQL\Database\Models\MyModel\0
to this:
\\SQL\Database\Models\MyModel
If the source Model is a sandbox, you must include the version information in the command line. If the sandbox is versioned and you want to generate output from the new version, you must change the command line accordingly.
The command line interface uses the following syntax:
"<path of ArtisanPublisher.exe>\ArtisanPublisher.exe" /a /i="<document definition or document template>" /o="<output path>" [/s="<style>"] [/f="<format>"] [/pm="<model>"] [/adi="<active item>"] [/adg="<active diagram>"] [/v] [/l] [/ul] [/cl]
The command line interface uses the following arguments:
/a - specifies that the command line interface is being used.
For example: /a
/i - specifies the path and name of the Publisher Document Definition or Document Template to use for the generation.
When specifying a Document Template, use 'Default' for PTC provided Document Templates and 'User' for Document Templates you have created or imported, as demonstrated in the following examples.
For example:
/i="C:\My Folder\My Document Definition.ds"
/i="Default\SysML - Blocks.dtx"
/i="User\My Document Template.dtx"
/o- The /o argument behaves differently for different output formats:
For the Word and DocBook output formats, specifies the path and name of the generated output. In Publisher, this is derived from the Output Path property on the Generate pane and the document title (the document title determines the generated file name).
For example: /o="c:\my generated documents\all diagrams.doc".
For the Publisher HTML and Publisher XML output formats, specifies the path of the generated output. In Publisher, this is derived from the Output Path property on the Generate pane and the document title (a subfolder is generated for the document title).
For example: /o="c:\my generated html\subfolder for document title".
/s- specifies the style to use for the generation. In Publisher, this is specified through the Style property on the Generate pane. If the /s argument is not included, the generation uses the Style that is specified in the document definition.
For example: /s="PTC"
/f - specifies the format to use for the generation. In Publisher, this is set through the Output Format property on the Generate pane. If the /s argument is not included, the generation uses the Output Format that is specified in the document definition.
For example: /f="Word"
/pm - specifies the source model to use for the generation. In Publisher, this is specified through the Publication Model property on the Generate pane. Specify the model to use through the model's Reference, which is shown on the General tab of a Model's Property Pages.
For example: /pm="\\SQL\Database\Models\MyModel\0"
Important:
If you always want to use the latest trunk version of a model, delete the model version information from the model reference, for example, in the preceding example delete '\0'.
If you do not include the /pm argument, the Publication Model will be set to '\Active Model' and the source model for the generation will be the last model that was open in Modeler.
/adi- specifies a dictionary item to use as the active dictionary item in Modeler. Specify the active dictionary item through the item's Id. To find out the Id of an item, see the 'Finding Out the Id of an Item or Diagram' section that follows.
For example: /adi="722a7c83-adb0-4f34-bc81-95e511833371"
You will want to specify an active Modeler item only when the document definition includes one or more document structure items that have their Use Active Model As Source property set to True.
/adg- specifies a diagram to use as the active diagram in Modeler. Specify the active diagram through the diagram's Id. To find out the Id of a diagram, see the 'Finding Out the Id of an Item or Diagram' section that follows.
For example: /adg="f16b20ba-68eb-400a-a4aa-990a76861d6e"
You will want to specify an active diagram only when the document definition includes one or more document structure items that have their Use Active Model As Source property set to True.
/v - specifies that the Publisher window is shown while generating the output. When this argument is not included, Publisher is minimized during generation.
For example: /v
/l - specifies that verbose messages are generated to a log file. In Publisher, these messages appear in the Messages pane. The log file is generated to the %AppData%\Artisan Software Tools\Publisher\Commandline folder. The name of the generated log file depends on whether the /ul argument is included.
For example: /l
See also /ul and /cl.
Note that the /ul argument determines whether a single log file (PublisherRender.log) is overwritten each time output is generated through the command line interface, or whether a unique file is created each time output is generated through the command line interface.
/ul - when the /ul argument is included, specifies that a unique log file is generated each time the command line is used to generate output. The name of file is based on the date and time of generation: PublisherRender_hh-mm-ss_dd-mm-yyyy.log. For example, PublisherRender_14-08-05_06-08-2010.log.
For example: /ul
If the /l argument is included but the /ul is not included, the generated file is named PublisherRender.log.
See also /l and /cl.
/cl - specifies that all files in the %AppData%\Artisan Software Tools\Publisher\Commandline folder are deleted before generating output.
For example: /cl
See also /l and /ul.
Examples
This example generates a Word document from the active model in Modeler using the MyDocumentDefinition.ds document definition. The generated Word document is named MyDocument and it is generated to the C:\GenDocs folder.
"C:\Program Files\PTC Integrity
Modeler\Modeler\Exe\Publisher\ArtisanPublisher.exe" /a /i="C:\DocDefs\MyDocumentDefinition.ds" /o="C:\Docs\MyDocument.doc" /f="Word"
In this example we have added the /pm argument to specify which model is generated, that is, MyModel. We have removed the version number from the model reference so that the latest version of the model is always generated.
"C:\Program Files\PTC Integrity
Modeler\Modeler\Exe\Publisher\ArtisanPublisher.exe" /a /i="C:\DocDefs\MyDocumentDefinition.ds" /o="C:\Docs\MyDocument.doc" /f="Word" /pm="\\SQL\Computer\Models\MyModel"
In this example we have added the /l and /ul arguments to generate a unique log of the generation.
"C:\Program Files\PTC Integrity
Modeler\Modeler\Exe\Publisher\ArtisanPublisher.exe" /a /i="C:\DocDefs\MyDocumentDefinition.ds" /o="C:\Docs\MyDocument.doc" /pm="\\SQL\Computer\Models\MyModel" /l /ul
Finding Out the Id of an Item or Diagram
You can find out the Id of an item or diagram through TellMe.
To find out the Id of an item or diagram:
1. In the appropriate pane, select the item or diagram.
2. On the Tools menu, click TellMe.
3. From TellMe, in the Details pane, locate the Id entry in the Writable Properties section.
4. If you want to copy the Id to the Clipboard: right-click the Id entry, and then click Copy Property Value.