Print Interface
The Print object (Iprint) is returned by the CreatePrint function of the ComScript connection. Through this object, the functionality of the AMT-COBOL print utility can be used in programs that are written in any COM supporting development environment. FormId’s only work with wildcards.
The following functionality is provided:Properties
Name | Type | Access | Description |
AsFile | String | Read/Write | When printing to a printer with in the printer settings the 'Print fo File' checkbox checked, in the filename to print to an asterisk can be used. When printing this asterisk will be replace by the value set in the AsFile property followed by a unique four digit number. |
BannerFile | String | Read/Write | The name of the bannerfile to use for printing |
BannerId | String | Read/Write | Printcontroller will print the file with this banner id. |
DoNotPrint | Boolean | Read/Write | When set to true, the print request will be added to the completed prints list in the Control Center by the AMT print controller but not actually printed. It can then be printed by using the "Print again" button. |
ErrorCode | Integer | Readonly | The error code of the PrintObject. Zero means no error. |
ErrorDescription | String | Readonly | The description of the error. Is Ok when no error occurred |
ForcePrint | Boolean | Read/Write | If set to True the file will be printed, otherwise not. |
HookParameters | String | Read/Write | Used to pass parameters to the optional PrintFileHook. |
NumCopies | Integer | Read/Write | The number of copies to print |
RemoveFiles | Boolean | Read/Write | If set to True the files will be removed after printing including the entries in the system table |
SubDirectories | Boolean | Read/Write | If set to True the subdirectories will also be scanned for files to print. |
Wait |
Boolean |
Read/Write |
If set to True the printcontroller will wait till this print job has finished before starting new print jobs. |
WaitTimeOut | Integer | Read/Write | With this property a timeout can be set on print commands. The value given will be in seconds. When set to zero (default) there will be no timeout. |
Functions
Function Name | Return type | Parameters | Description | |
Name | Type | |||
AddFormId | Boolean | FormId | String | When a FormId is added only printfiles printed with the given FormId will be printed. Returns 'True' if successful. |
AddPrintFile | Integer | PrintFile | String | Adds the Print file specified in PrintFile to the AMTSYSPRINTFILE table in the system database. The JobName, number of Pages to print, the Title of the print and which printer should be used can be set. Returns the PrintFile Id. |
JobName | String | |||
Pages | Integer | |||
Title | String | |||
Printer | String | |||
ClearSettings | Void | --- | Clears all the settings from a previous print | |
PrintFile | Integer | FileName | String | Prints the file specified in FileName to the printer specified in Printer, the Filename should be given as path/filename combination. Using an * (asterisk) instead of the filename, will scan the directory for files to print. If the print file was already present in the AMTSYSPRINTFILE table, the previously set data will be used when printing with the exception of the printer. Otherwise default values will be used. Returns 0 if successful, -1 upon failure. |
Printer | String | |||
UpdatePrintFileTitle | Integer | PrintFile | String | Changes the PrintFile title to a new Title. The PrintFile title is shown in the AMT Control Center 'Prints' menu. |
Title | String |
Example
PowerShell
#See ComScript Connection Interface
...
$ComScr.Connect()
#Create an Object of the Print Interface
$PrintObject = $ComScr.CreatePrint()
$PrintObject.ForcePrint = $true
$PrintObject.RemoveFiles = $true
$PrintFileName = "$($ComScr.PrintPath)\TestPrintFile*"
$PrintObject.PrintFile($PrintName, "HP3015")
if ($PrintObject.ErrorCode -ne 0) {
[void]$Msg.AddMsgInformation("ErrorCode is: $($PrintObject.ErrorCode)")
[void]$Msg.AddMsgInformation("ErrorDescription is: $($PrintObject.ErrorDescription)")
}
# Finally release the variables and clean up the session.
$ComScr.Dispose()