Running External Windows Programs
It is possible to run external non AMT Windows Programs through the Batchcontroller. I.e. when an External Windows Program executable is placed in the same folder as the Reports of the Application, it will be visible in the Control Center in the list of available Jobs in System Configuration -> Batch and Jobs -> Tab Available Jobs. It can then be controlled as normal report by using the Job Management functionality of the Control Center and the ComScript Job Interface. The command to run the External Windows Program will then be handled as a normal Job Request, i.e. it will be added to a Job Queue and will be executed under the control of a Batch Controller servicing that queue.
Exchanging Information with the External Windows Program
Job Request Information
When an External Windows Program is ran through the BatchController the following Windows Environment Variables will be available in the program:
- DBSERVER: The name of the server used by the Application.
- DBNAME: The name of the Database used by the Application.
- DBPASSWORD: The password used to log in to the Application Database
- DBUSER: The Username used to log in the Application Database.
- RQUESTID: The Request id of the Job Request that runs the External Windows Program
Parameters
Parameters can be passed to the External Windows Program using the ComScript Job Interface property GlobalParameter. This property should contain a list of parameters separated by spaces (e.g. 'Param1 Param2 Param3'. This list will then available in the program as a list of separate Environment Variables in the following way:
PARM1 = Param1
PARM2 = Param2
PARM3 = Param3
Any number of parameters can be used. When no parameters are set only PARM1 will be available and contain an empty string.
Extract Files
File Id's and Filename's of extract files to use can be communicated to the External Windows Program using the ComScript JobInterface AddExtractFile function. The File Id and Filename will then be available to the program as Environment Variable:
dd_<FileId> = <FileName>
Exit Code
When the External Window Program finishes execution, the exit code set by the program will be available as TaskValue Key EXITCODE. It can then read back in the report or script using the ComScript Job Interface function <JobOject>.GetTVCustom('EXITCODE').