Batch

All batch related events and batch related operations like Batch Restructuring are precessed by the core CscScriptBatch batch object. This object is available for both the project and the root folder script sheet, and is addressed by Batch.

The events of the Batch object are available in the project script sheet and are divided into events that are available for every module that supports scripting, and those events that are only related to user interactions during batch editing.

In the following image, the events are shown that are available for most modules and that allow batch handling customization. The Batch_InteractiveClosing event is not available for server modules. It is available only for user interactive modules. The user interactive modules that support this event are Document Review, Validation, Verification, Thin Client Validation, or Thin Client Verification.

An image that shows the Batch event sequence

This sequence is typical for every user interactive module. To distinguish the executing module in these shared events please use the Project.ScriptExecutionMode property, and if applicable, the Project.ScriptExecutionInstance property for getting the information about the running instance of the module.

Application_InitializeBatch Event

The first event is not an event that is attached to the Batch object. Instead, the Application_InitializeBatch event initializes batch processing and is attached to the Application object that is also defined on the project script sheet. In the Application_InitializeBatch event the script has read-only access to the given XFolder root object. In those events no changes to the batch structure or to the root XFolder are allowed, but you can apply batch-related initializations and read batch properties. The Application_InitializeBatch event is fired multiple times for parallelized server processing and is dependent on the number of Server threads that are running independently for that batch.

Batch_Open Event

The Batch_Open event is fired once per module and once per batch only and provides extended access to the batch object that allows Batch Restructuring. This is also true for the parallelized Server processing.

Batch_Close Event

When a batch is closed in any module the Batch_Close event is fired once per batch, and provides extended access to the batch object that allows Batch Restructuring. This is also true for the parallelized Server processing.

Batch_InteractiveClosing Event

When a batch is closed during a user interactive module such as Document Review, Validation, Verification, Thin Client Validation, or Thin Client Verification, then the Batch_InteractiveClosing event is fired once. You can use this event to stop a user from closing a batch. It is possible to access the batch object using the pXRootFolder. This parameter is read-only in the event and cannot be modified.

A closeMode parameter is also available and with the following possible values:

  • CscBatchCloseSuspend

  • CscBatchCloseError

  • CscBatchCloseFinal

You can cancel the closing of a batch by setting the bCancel parameter to TRUE. You can also provide text in the sMessage parameter so that it contains information that is shown to the user to explain why they cannot close a batch.