AMT Help Files
homeAMT AdminAdvanced FunctionsComScript ModulePrint Interface

Print Interface

The Print object (Iprint) is returned by the CreatePrint function of the ComScript connection. Through this object, the functionality of the AMT 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. '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
CreatePrintRequest Integer PrintFileId Integer Creates a print request on an explicit queue. The print file must already be registered via AddPrintFile. Uses NumCopies, HookParameters, BannerFile, BannerId, AsFile, RemoveFiles, and FormId from the current property values on this object. Returns the RequestId on success, -1 on failure.

The PrintFileId should be set to the ID returned from the AddPrintFile function.
QueueName should be set to the name of the target print queue.
Printer should be set to the name of the target printer. If left empty, the default printer for the set print queue will be used.
PrintRequestKind is the print request kind as integer: Print=1, PrintAndKeep=5, Hold=6, Leave=7. See the AmtPrintRequestKind table below for all options.
Options is a comma-separated list of options. (e.g. "JOBNAME=XXX,SCRIPT=YYY"). May be empty.
User is the user on behalf of whom the print request is created. This is optional and can be left empty.

QueueName String
Printer String
PrintRequestKind Integer
Options String
User String
   
FindPrintRequests String OptionsFilter String Finds print requests matching the given criteria. Used for cross-job ALTER/DELETE lookups.
Returns a comma-separated string of RequestIds, or an empty string if no matches are found.
QueueName String
PrintRequestKind Integer
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
   
RemovePrintRequest Integer RequestId Integer Removes a print request from the database. Used for cross-job DELETE operations.
Returns 0 on success, -1 on failure.
UpdatePrintFileTitle Integer PrintFile String

Changes the PrintFile title to a new Title. The PrintFile title is shown in the AMT Control Center 'Prints' menu.
Returns 0 if successful, -1 upon failure.

Title String
   
UpdatePrintRequest Integer RequestId Integer Updates an existing print request in the database. Used for cross-job ALTER operations. Only non-null/non-empty parameters are applied; pass null or empty to skip a field. The only exception is the options field, where an empty string will clear all options. The PrintRequestKind 0 means "do not change".
Returns 0 on success, -1 on failure.
QueueName String
Printer String
PrintRequestKind Integer
Options String
User String
   

AmtPrintRequestKind

Value Print Request Kind Description
0 Invalid Invalid.
1 Print Normal print request.
2 DontPrint Do not print.
3 PrintAgain Print the printfile again.
4 RemoveFile Delete the printfile.
5 PrintAndKeep Print the file and keep the request (set to Leave after processing).
6 Hold Held, not eligible for processing until released.
7 Leave Already processed, left in queue (not picked up unless re-activated).

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()

 

Contents

 Go to top