Message Interface
The Message object (IMessage) is returned by the CreateMessage function of the ComScript connection. Through this object, messages can be written to the AMT-COBOL environment and message requests can be answered.
The following functionality is provided:Properties
Name | Type | Access | Description |
ErrorCode | Integer | Readonly | The error code of the Message Object. Zero when no error occurred. |
ErrorDescription | String | Readonly | The error description of the error. Ok when no error occurred. |
TimeOut | Integer | Read/Write | With this property a timeout can be set on the AddRequest() function. The default value is zero (no timeout set). When set to any other value the AddRequest() function will generate when the request has not been confirmed within the set time in minutes. |
Functions
Function name | Type |
Parameters | Description | |
Name | Type | |||
AddMsgError | Integer | Message | String | The string Message will be sent and displayed in the Control Center in the menu item Messages, subfolder Alerts as an Error message (red flagged). Returned will be the message Id. |
AddMsgInformation | Integer | Message | String | The string Message will be sent and displayed in the Control Center in the menu item Messages, subfolder Alerts as an Information message (green flagged). Returned will be the message Id. |
AddMsgWarning | Integer | Message | String | The string Message will be sent and displayed in the Control Center in the menu item Messages, subfolder Alerts as a Warning message (yellow flagged). Returned will be the message Id. |
AddRequest | String | Request | String | A Confirmation Request will be sent and displayed in the Control Center in the menu item Messages, subfolder Requests. When a Confirmation text is entered in either an Accept file or manually in the Control Center, this text string will be returned to the script. |
AddWaiting | Integer | Waiting | String | A Waiting request will be sent and displayed in the Control Center in the menu item Messages, subfolder Waitings. Returned will be the Message Id of the Waiting. A Waiting message can be cleared with the function ClearWaiting using the Message Id of the Waiting. |
ClearWaiting | Boolean | WaitingId | Integer | Deletes the Waiting message with the given WaitingId from the Waiting list. If the operation was succesful, True will be returned. |
Example
PowerShell
#See ComScript Connection Interface
...
$ComScr.Connect()
#Create an Object of the Message Interface to be able to write log messages to the system database.
#The written messages will show in the Messages section of the Control and Application Center.
$Msg = $ComScr.CreateMessage()
[void]$Msg.AddMsgInformation("Connected.")
# Finally release the variables and clean up the session.
$ComScr.Dispose()