This becomes a really useful tool if scheduling multiple Templates to run or update documents, It is also useful if issues are detected when running C4W
First create a folder on the desktop called C4W and create 4 Folders inside
Data
Logs
Result
Template
Run CMXML and save the data and filter files into the data folder the .png files will then also download to this folder automatically
Then create and add your template file/files into the Template folder
Next step is to open a new notepad file
Add the line ‘@ECHO on’ this command tells the interpreter to expect further commands
Next add a heading ‘:Variables used’ the : tells the interpreter to ignore the following text
The first command is,
set wordTemplate="C:\Users\<account username>\Desktop\C4W\Templates\<name of template>.dotx"
You need to add your local windows logon to replace <account username> and the name of your first template file replaces the <Name of template> also notice the “ “ wrapping the file path, this allows for spaces to be used in the file path if required.
You can copy and paste this line and just change the name of template if you have multiple templates to run
The second command is to say what you want created
set targetFolder="C:\Users\<account username>\Desktop\C4W\Result\<name of resulting file>.pdf"
once again change the <account username> and <Name of resulting file> to match your needs the file can be saved as either .pdf or Docx you need to create a result for each template.
The third and fourth command are to tell the script where to find the information
set dataDefinition="C:\Users\<account username>\Desktop\C4W\data\<data xml>.xml"
set dataFilter="C:\Users\<account username>\Desktop\C4W\data\<Filter xml>.xml"
Again change the text between the <> symbols to match your environmental details
The fifth command creates an error log file called Summary_Test.log
set logPath="C:\Users\<account username>\Desktop\C4W\Logs\Summary_test.log"
This log file is only created if there is an error running the script
Next create a heading :Executing C4W
This is where the actual command script is placed
"C:\Program Files (x86)\Casewise\Communicator4Word\Communicator4Word.exe" -Username:<Username> -Password:<password> -Datadefinition:%dataDefinition% -Datafilter:%dataFilter% -wordtemplate:%wordTemplate% -Targetdocument:%targetFolder% -filetype:PDF -Log:%logPath% -Usage:DOCGENSILENT
You will need to change the username and password to match your User account
The file type will work with the following File types
Pdf
Doc
Docx
Finally, we add the command Exit 0 (The 0 means close if no errors are detected)
The command Pause can be added before the exit command, this will keep the Command window on screen until you press a key to close it
Run the batch file as administrator and check the logs folder for a file being generated, if no file is generated its all worked correctly.
The Batch script itself will query the database for new information and update the date and filter xml files as well as the .png files
@ECHO on
:Variables used
set wordTemplate="C:\Users\<account username>\Desktop\C4W\Templates\<name of template>.dotx"
set targetFolder="C:\Users\<account username>\Desktop\C4W\Result\<name of resulting file>.pdf"
set dataDefinition="C:\Users\<account username>\Desktop\C4W\data\<data xml>.xml"
set dataFilter="C:\Users\<account username>\Desktop\C4W\data\<Filter xml>.xml"
set logPath="C:\Users\<account username>\Desktop\C4W\Logs\Summary_test.log"
:Executing C4W
"C:\Program Files (x86)\Casewise\Communicator4Word\Communicator4Word.exe" -Username:<Username> -Password:<password> -Datadefinition:%dataDefinition% -Datafilter:%dataFilter% -wordtemplate:%wordTemplate% -Targetdocument:%targetFolder% -filetype:PDF -Log:%logPath% -Usage:DOCGENSILENT
Pause
EXIT 0
© ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center