It is possible to call a .bat file from the workflow in InterFormNG2, if you run InterFormNG2 on the windows platform. This can e.g. be used if you want to create PDF files with InterFormNG2, that are to be archived with a special command on the Windows platform or e.g. in order to interface with a fax solution to fax the generated PDF file.
In the workflow you can create a PDF file and call a bat file with a workflow like this:
The workflow monitors a directory for XML files with the Read from file component, then a PDF file is created with the Create PDF file component and finally the component, Execute native OS command is called in order to call a .bat file, that in this case lists the received data.
The Execute native OS command setup above looks like this:
(As you can see a full path and file name of the bat file is to be included)
In order to dump the received data this .bat file is used:
( echo PROGRAM: %0% echo PDFFILE: %1% echo INFO: %2% echo ADDITIONAL: %3% ) > C:\ProgramData\InterFormNG2\filename.txt |
After running an XML file through this workflow the filename.txt file is generated with this as the contents:
PROGRAM: C:\ProgramData\InterFormNG2\WindowsDump.bat PDFFILE: C:\ProgramData\InterFormNG2/outbox/default.pdf INFO: "<info><metaData><key>CamelFileLastModified</key><value>1566198898000</value></metaData><metaData><key>interform.input.file.onlyname.noext.single</key><value>Intro_demo</value></metaData><metaData><key>interform.input.file.name.ext</key><value>xml</value></metaData><metaData><key>com.interform400.xml.Template</key><value>/Training/Dummy.ift</value></metaData><metaData><key>interform.input.file.name.ext.single</key><value>xml</value></metaData><metaData><key>CamelFileLength</key><value>6525</value></metaData><metaData><key>interform.plugin.archiver.fileName</key><value>default.pdf</value></metaData><metaData><key>interformng.output.conflictResolution</key><value>Overwrite</value></metaData><metaData><key>interform.input.file.path</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing\Intro_demo.xml</value></metaData><metaData><key>CamelFileName</key><value>Intro_demo.xml</value></metaData><metaData><key>interform.input.file.parent</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing</value></metaData><metaData><key>NG2.TENANTID</key><value>home</value></metaData><metaData><key>interform.input.file.name.noext</key><value>Intro_demo</value></metaData><metaData><key>breadcrumbId</key><value>ID-MSI-1614277101746-0-1</value></metaData><metaData><key>interform.input.file.ext</key><value>xml</value></metaData><metaData><key>interform.input.file.name.noext.single</key><value>Intro_demo</value></metaData><metaData><key>interform.input.file.onlyname.noext</key><value>Intro_demo</value></metaData><metaData><key>CamelFileParent</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing</value></metaData><metaData><key>interform.input.file.modified</key><value>1566198898000</value></metaData><metaData><key>interform.input.file.length</key><value>6525</value></metaData><metaData><key>interformng.mimeType</key><value>application/pdf</value></metaData><metaData><key>CamelFilePath</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing\Intro_demo.xml</value></metaData><metaData><key>interform.input.file.name</key><value>Intro_demo.xml</value></metaData><metaData><key>interformLogName</key><value>file</value></metaData><metaData><key>interform.input.file.onlyname</key><value>Intro_demo.xml</value></metaData><metaData><key>interformParentLogId</key><value>dceebe8e-2ef5-499d-92db-6b3f1bf2efd2</value></metaData><metaData><key>interform.input.file.absolute.path</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing\Intro_demo.xml</value></metaData><metaData><key>interform.input.file.size</key><value>6525</value></metaData><metaData><key>CamelFileAbsolute</key><value>true</value></metaData><metaData><key>interform.input.file.absolute</key><value>true</value></metaData><metaData><key>CamelFileNameConsumed</key><value>Intro_demo.xml</value></metaData><metaData><key>CamelFileRelativePath</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing\Intro_demo.xml</value></metaData><metaData><key>interform.workflow.name</key><value>Bat file</value></metaData><metaData><key>interform.plugin.archiver.folderName</key><value>C:\ProgramData\InterFormNG2/outbox</value></metaData><metaData><key>renderer.page.last</key><value>1</value></metaData><metaData><key>CamelFileAbsolutePath</key><value>C:\ProgramData\InterFormNG2\inbox_bat_file\processing\Intro_demo.xml</value></metaData><metaData><key>interformLogId</key><value>5787177a-3f67-446c-b8ad-5564c74733b8</value></metaData><metaData><key>CamelFileNameOnly</key><value>Intro_demo.xml</value></metaData></info>" ADDITIONAL: |
As you can see above the parameters are in this sequence:
1. Parameter, Program
The name and path of the program.
2. Parameter, PDF file
The name and path of the PDF file, that was just created (if any was created).
3. Parameter, Info
An XML with all workflow variables, that have been defined, followed by the value of the variable.
4. Parameter, Additional
The value of the extra optional variable setup on the workflow component, Execute native OS command.