When a script is executed the following error message may appear:
Document 1: System.Runtime.InteropServices.COMException (0x80004005): Cannot modify batch structure from this script. at ABBYY.FlexiCapture.IBatch.DeletePage(IPage _page) at Main.Execute(IDocument Document, IProcessingCallback Processing)
The reason is that method that is intended to be called on the Batch processing type is actually being called on the Document Processing type.
Switch the workflow script stage to the Batch Processing type.