AMT Help Files

Connection Interface

This section details the functions and properties of the Task Object Connection Interface. It's main use is to connect to an application, set a number of defaults and then create a Job Interface object, through which jobs can be started and controlled.

Properties

Name   Type   Access   Description  
ApplicationPath String  Read only  Returns the Basepath of the application the ComScript Module is connected to.
AppName STring Read/Write The name of the application the ComScript Module will connect to when executing the Connect function.
BatchId  Integer Read only  If the script is started from another script this property returns the JobId of the script that started this script.
Connected Boolean   Read only  Returns the value True when the ComScript Module is connected to an application and False otherwise. 
Development   Boolean  Read only  Returns True when development has been set in the Configuration set in the Control Center used for this application. 
Environment   String  Read only  Returns the Environment string of the Base setup of this environment as entered in the Control Center. 
ErrorCode Integer Read only The error code after a comscript operation. Zero means no error occurred.
ErrorDescription String Read only The error description after a comscript operation. Ok in case no error occurred.
ExtractPath  String  Read only  Returns the extract path as set for the connected application. 
JobId Integer Read only Returns the JobId of this script as shown in the list of available Jobs in the Control Center.
JobName String Read/Write Can be set to a name describing the script. It will be used in messages as source of the message for logging. It can be read back for use in the script.
PrintPath  String  Read only  Returns the print path as set for the connected application 
ProcessId Integer Read only Returns the Windows process number of the script engine this script runs in.
ReportPath  String  Read only  Returns the report path as set for the connected application 
ScriptPath  String  Read only  Returns the script path as set for the connected application 
Station String Read/Write This property can be set to a name describing the station this script is run from. It is used when writing messages to the logs and when starting jobs. It can be read back for use in this script.
StealthMode  String  Read/Write When set to true, no registration of the initiating process will be performed on a subsequent Connect.
SysIniFile   String  Read/Write Sets the Sys.ini file to use. This needs to be set before the call to the function Connect() is made in order to use the correct Environment. 
SystemPath  String  Read only  Returns the path of the root of this Environment as set in the Base path in the Control Center. 
User  String  Read/Write The user name to use for this ComScript Session.  Defaults to the Username of the owner of the process that runs the script but can be set differently.

Functions

Function name Return type Parameters  
Name                 Type
Description
AddDefaultBackupDir Void BackupDir String Sets the backup directory for the print commands to use for printing to the default PROUT printer.
AddDefaultBanner  Void  BannerFile  String  Sets the Banner file to use in print commands for the default PROUT printer. Should be given as absolute path\filename and can be overwritten in the Job and Print class objects. 
AddDefaultFormId  Void  FormId  String  Sets the Form Id to use for print commands for the default PROUT printer. Can be overwritten in the Job and Print class objects. When set the print files will be placed in a subdirectory named <FormId> inside the prints directory. This setting is overwritten when a Backup directory is set. 
AddDefaultPrintSetting Void  PrintFile  String  Sets the default print settings for the printer with PrintId PROUT. These settings will be used as defaults when a Print Object is created and can be overwritten inside the Print Object.
Printer  String 
DontPrint  Boolean 
NumOfCopies Integer 
PrintBanner  Boolean 
NoDateSubDir Boolean 
   
Connect  Void  None    Connect to the System Database set in the Sys.ini file referred to in the SysIniFile property and retrieve information for the application set in the AppName Property. 
CountJobs  Integer  JobNameMask String  Returns the number of jobs running with the specified Job Name Mask. Mask characters are a % for any character or any number of characters and a _ (underscore) for a single any character.
CreateJob Job Object None
Creates a Job Object of the Job interface.
CreatePrint Print Object None
Creates a Print Object of the Print interface.
FindRunningJob  Job Object  JobName  String  Returns a Job Object for the first found running job with the name specified in JobName. All the Job Objects properties will be filled with the values of the given job.
FindRunningJobById  Job Object  RequestId  Integer  Returns a Job Object for the job with the given RequestId. All the Job Objects properties will be filled with the values of the given job.
GetJobs List of Job Objects None
Returns a list of Job Objects including their state.
Get a list of all reports/programs with the states: running, waiting & queued. In essence all jobs which are not finished.
GetMySelf
Job Object
None
  Returns a Job Object for the running Report itself.
GetQueuedJobs List of Job Objects None   Returns a list of Job Objects that are queued to be processed by the BatchController.

A list of jobs that has been processed by the BatchController can be gotten by using the GetJobs function.  
JobIdbyJobName  Integer  JobName  String  Returns the JobId as defined in the Control Center for the with the given JobName and JobType (0 unspecified, 1 Script, 2 Batch, 3 Report and 4 Executable). When no job with the given name is found -1 will be returned.
JobType  Integer 

 

Return to

Task Object