BatchAPI Function Details - OCR for AnyDoc - Foundation 23.1 - Foundation 23.1 - AnyDoc - external

OCR for AnyDoc Programming Reference Guide

Platform
AnyDoc
Product
OCR for AnyDoc
Release
Foundation 23.1
License

Function

Indication

Syntax

OCRFFAPI_Connect

Establishes a line of communication between the client and the OCR for AnyDoc server executable specified.

int OCRFFAPI_API

OCRFFAPI_Connect(LPCSTR pszOCRFFExe, BOOL bHideIcon)

OCRFFAPI_Disconnect

Disconnects from the server and optionally closes OCR for AnyDoc.

int OCRFFAPI_API

OCRFFAPI_Disconnect(BOOL bCloseOCRFF);

OCRFFAPI_ConnectService

Establishes a line of communication between the server client and the OCR for AnyDoc server executable specified.

int OCRFFAPI_API

OCRFFAPI_ConnectService(LPCSTR pszOCRFFExe);

OCRFFAPI_DisconnectService

Disconnects and closes OCR for AnyDoc.

int OCRFFAPI_API

OCRFFAPI_DisconnectService;

OCRFFAPI_BatchProcess

This function initiates processing for the requested batch process function. Batch processes available through the batch interface library are:

  • Scanning/Importing

  • Quality Assure/Rescan/Review

  • Rescan

  • Classification

  • Exceptions

  • Extraction

  • Rules Validation

  • Verification (High Speed, Pass 1, Pass 2, Supervisor, and Balancing)

  • Commit

Individual or multiple batch processes can be performed with a single call to the OCRFFAPI_BatchProcess() function. This functionality simulates the station AutoFlow configuration within OCR for AnyDoc. For example, OCRFFAPI_BatchProcess() can initiate an Import process followed by Extraction and then return control back to the Client.

Information is communicated from the server to the client by either sending messages to a supplied window handle or to an ASCII file. See Receive Information from OCR for AnyDoc (page Receive Information from OCR for AnyDoc).

int OCRFFAPI_API

OCRFFAPI_BatchProcess(LPBATCHAPISTRUCT lpAPI);

The BatchAPI functions use the following elements:

Element

Indication

pszOCRFFExe

If OCR for AnyDoc is not already executing, the library attempts to load the specified executable name. If the server executable name is not fully qualified, it must reside in the working directory or DOS path. If OCR for AnyDoc is already executing, it is minimized to an icon.

bHideIcon

The OCR for AnyDoc icon is hidden for all non-interactive batch processes.

bCloseOCRFF

A switch to determine if OCR for AnyDoc is shut down when the client disconnects. If False, OCR for AnyDoc remains executing. If True, OCR for AnyDoc is shut down.

Connection Example:

char szExeName[_MAX_PATH] = "c:\\Program Files\\Hyland\\OCR for AnyDoc\\OCRforAnyDoc.exe";

int nReturn = OCRFFAPI_Connect(szExeName,FALSE);

if (nReturn != OCRFF_SUCCESS)

{

char szMsg[100];

OCRFFAPI_Error2String(nReturn,szMsg);

MessageBox(GetActiveWindow(),szMsg,"Client Error",MB_ICONSTOP);

}

Note:

A connect function must be called before any other library functions.

Disconnect Example:

int nReturn = OCRFFAPI_Disonnect(TRUE); /* shut down OCRFF */
if (nReturn != OCRFF_SUCCESS)
{
char szMsg[100];
OCRFFAPI_Error2String(nReturn,szMsg);
MessageBox(GetActiveWindow(),szMsg,"Client Error",MB_ICONSTOP);
}
Note:

A disconnect function must be called before the client application terminates.

lpAPI

Pointer to a BATCHAPISTRUCT structure defined in ocrffapi.h and allocated by the client that contains the following elements to initiate batch processes in OCR for AnyDoc.

Element

Indication

nStructureSize

The size of the BATCHAPISTRUCT structure the client program is utilizing. The size of the structure can be used to compare the size of the client's defined structure against the size of the structure being utilized by the interface library and OCR for AnyDoc. This protects OCR for AnyDoc from having a version mismatch with the client.

hClientInfo

Identifies the handle of the window to receive information (job status, messages, and error messages) from OCR for AnyDoc via the Batch Interface Library.

szClientInfo

The name of the file to receive information (job status, messages, and error messages) from OCR for AnyDoc via the Batch Interface Library.

szFormFamily

Points to the form family (.fof) to be processed.

bOCRFFSilentMode

A switch to determine if OCR for AnyDoc handles any messages or errors internally via message boxes (if equal to 0) or if any messages or errors are passed to the client (if equal to 1).

bPostJobStartMessages

A switch to determine if OCR for AnyDoc posts status messages to the client before each job.

bPostJobStatusMessages

A switch to determine if OCR for AnyDoc posts status messages to the client after the completion of each job.

bPostErrorWarningMessages

A switch to determine if OCR for AnyDoc posts error warning messages to the client.

bPostProcessCompleteMessages

A switch to determine if OCR for AnyDoc posts process complete messages to the client after each batch process.

nBatchTransaction

Identifies the batch process to be performed by OCR for AnyDoc.

nBatchTransaction Processes

Use the bit-wise, operations, or the following values to configure lpAPI->nBatchTransaction for multiple batch processes:

Process

Identifier

Value

Scan

BATCH_API_SCAN

1

Import

BATCH_API_IMPORT

2

Quality Assure

BATCH_API_QA

512

Rescan

BATCH_API_RESCAN

1024

Review

BATCH_API_REVIEW

16384

Identification

BATCH_API_IDENTIFY

4

Exception Handler

BATCH_API_EXCEPTION

8

Extraction

BATCH_API_EXTRACT

16

Rules Validation

BATCH_API_RULES_VALIDATION

4096

Verification (HSV)

BATCH_API_VERIFY_HSV

8192

Verification (Pass 1)

BATCH_API_VERIFY

32

Verification (Pass 2)

BATCH_API_VERIFY_PASS_2

128

Verification (Supervisor)

BATCH_API_VERIFY_SUPERVISOR

256

Verification (Balancing)

BATCH_API_VERIFY_BALANCING

2048

Commit

BATCH_API_COMMIT

64

Element

Indication

nDislayPollingDialog

A switch to determine if OCR for AnyDoc displays the Polling Countdown timer window for Scan and Import processes.

szOverrideImportPath/szOverrideImportMask

When performing an Import, these options override the configured import path and mask for the specified form family.

nAPIAbortedProcessAction

The client calls the OCRFFAPI_JobAbort() function while OCR for AnyDoc is processing a switch to determine if the non-user interactive batch status window is displayed.

nAPIAbortedProcessAction

This element returns the following values.

Process

Identifier

Value

OCRFF Normal

APIABORT_ACTION_NORMAL

0

Keep Batch

APIABORT_ACTION_SCNIMP_KEEP

1

Delete Batch

APIABORT_ACTION_SCNIMP_DELETE

2

Keep Batch

APIABORT_ACTION_VERIFY_KEEP

1

Release Batch

APIABORT_ACTION_VERIFY_RELEASE

2

Element

Indication

nDisplayBatchStatusDialog, nBatchDialogXPos/ nBatchDialogYPos, and nVerifyBatchDialogWidth/ nVerifyBatchDialogHeight

If nDisplayBatchStatusDialog is equal to DLG_DISPLAY_NO, OCR for AnyDoc remains iconic for these processes.

If nDisplayBatchStatusDialog is equal to DLG_DISPLAY_CENTER, OCR for AnyDoc displays the batch status window centered on the window.

If nDisplayBatchStatusDialog is equal to DLG_DISPLAY_MOVE, the batch status windows are moved on the window to the specified X and Y positions.

Action

Identifier

Value

No dialog display

DLG_DISPLAY_NO

0

Display Centered

DLG_DISPLAY_CENTER

1

Display @ x,y

DLG_DISPLAY_MOVE

2

If nDisplayBatchStatusDialog is equal to DLG_DISPLAY_MOVE, the Verifier window is sized to the specified nVerifyBatchDialogWidth and nVerifyBatchDialogHeight.

These values are valid only for the Verification process.

Element

Indication

szOverrideImportPath and szOverrideImportMask

Allow overrides to the current form family settings for Import path and mask.

szQAOperators, szQARescanOperators, szQAReviewOperators, szHSVVerificationOperators, szPass1VerificationOperators, szPass2VerificationOperators, szSupervisorVerificationOperators, and szBalanceVerificationOperators

Allow the specific assignment of batch phase operators at Scan/Import time. These settings override what is currently set in the form family. If specifying multiple operators in the buffer, delimit each operator name with a space.

nJobProcessCount, nBatchProcessCount, and szBatchID

These provide optional control over the amount of work to be performed by OCR for AnyDoc. When a call to OCRFFAPI_BatchProcess() to extract, all pending Extraction work for the form family is completed before control is returned to the client. If there are 100 batches of 250 images pending Extraction, all 2500 Extraction jobs are completed before returning control to the client.

Use nJobProcessCount to Extract a specific number of jobs and then return control to the client. For example, if there are 2500 pending Extraction jobs, you can specify the Extraction process to stop after 25 jobs and return control to the client.

Use szBatchID to Extract a specific batch and return control to the client. The szBatchID and nJobProcessCount options can be used together to Extract just 15 images of 250 for a specific batch.

Use nBatchProcessCount to Extract a specific number of batches and then return control to the client. You can also use nJobProcessCount to Extract a specific number of jobs and then return control to the client. The nBatchProcessCount and nJobProcessCount options can be used together to Extract the first 325 images of no more than 2 batches.

Example

BATCHAPISTRUCT BatchAPI;
memset(&BatchAPI,0x00,sizeof(BATCHAPISTRUCT));
BatchAPI.nStructureSize = sizeof(BATCHAPISTRUCT);
/* If using handle method */
BatchAPI.hClientInfo = m_hWnd;
lstrcpy(BatchAPI.szFormFamily,”test.fof”);
BatchAPI.bOCRFFSilentMode = TRUE;
BatchAPI.bPostJobStartMessages = FALSE;
BatchAPI.bPostJobStatusMessages = TRUE;
BatchAPI.bPostErrorWarningMessages = TRUE;
BatchAPI.bPostProcessCompleteMessages = TRUE;
BatchAPI.nAPIAbortedProcessAction =
APIABORT_ACTION_NORMAL;
BatchAPI.nDisplayBatchStatusDialog = DLG_DISPLAY_CENTER;
lstrcpy(BatchAPI.szBatchID,”00001234”);
BatchAPI.nJobProcessCount = 0;
BatchAPI.nBatchTransaction = 0;
BatchAPI.nBatchTransaction |= BATCH_API_SCAN;
BatchAPI.nBatchTransaction |= BATCH_API_QA;
BatchAPI.nBatchTransaction |= BATCH_API_EXTRACT;
BatchAPI.nBatchTransaction |= BATCH_API_VERIFY;
BatchAPI.nBatchTransaction |= BATCH_API_COMMIT;
int nReturn = OCRFFAPI_BatchProcess(&BatchAPI);
if(nReturn != OCRFF_SUCCESS)
{
char szMsg[100];
OCRFFAPI_Error2String(nReturn,szMsg);
MessageBox(GetActiveWindow(),szMsg,"Client",MB_ICONSTOP);
}

OCRFFAPI_GetAutoFlow

Returns AutoFlow information in the parameter.

int OCRFFAPI_API

OCRFFAPI_GetAutoFlow(LPSYSTEMAUTOFLOWSTRUCT);

OCRFFAPI_StartAutoFlow

Starts AutoFlow using the information given in lpAutoFlow.

BOOL OCRFFAPI_API

OCRFFAPI_StartAutoFlow(LPSTARTAUTOFLOWSTRUCT, LPHANDLE);

OCRFFAPI_EndAutoFlow

Ends AutoFlow.

int OCRFFAPI_API

OCRFFAPI_EndAutoFlow(void);