AMT Help Files

JobAlive Interface

The JobAlive object (IJobAlive) is returned by the CreateJobAlive function that is provided through the ComScript connection interface. This object exposes the functionality of the JobAlive utility in programs written in any COM-supporting development environment.

The following functionality is provided:

Properties

Name Type Access Description
AppName String Read/Write The check for alive jobs will be performed for jobs of the application this property is set to.
ErrorCode Integer Read-only The error code of the JobAlive object. Zero when there is no error.
ErrorDescription String Read-only The description of the error. Will be Ok when there was no error.
JobsAlive Boolean Read-only When there are alive jobs that are not in the exclusion list this property is set to True.
ReportsOnly Boolean Read/Write When set to True the check for alive jobs will only be performed on reports. Meaning scripts and batches will be ignored.

Functions

Function name Return type Parameters Description
Name Type
Add Void JobName String Add the given job to the exclusion list. This job will then be ignored in the check for alive jobs.
Clear Void --- Clears the exclusion list.
Initialize Void --- Initializes the JobAlive object. Meaning it clears the errorcode and description, clears the exclusion list and sets the property ReportsOnly to True.

Example

PowerShell

# See ComScript Connection Interface
# ...

$ComScr.Connect()

# Create an Object of the JobAlive Interface to be able to detect alive jobs
$JobsAlive = $ComScr.CreateJobAlive()

$JobsAlive.Initialize()
$JobsAlive.ReportsOnly = $false

if (-not ($JobsAlive.JobsAlive)) {
  Write-Host "There are no jobs alive"
} else {
  Write-Host "There are jobs alive"
}

if ($JobsAlive.ErrorCode -ne 0) {
  [void]$Msg.AddMsgInformation("ErrorCode is: $($JobAlive.ErrorCode)")
  [void]$Msg.AddMsgInformation("ErrorDescription is: $($JobAlive.ErrorDescription)")
}

# Finally release the variables and clean up the session.
$ComScr.Dispose()

Contents