Capture enables you to create custom scripts to suit your business requirements. Scripts provide hooks into client events. You can create a client script that gets executed when certain Capture client events are triggered.
Extensions allow you to customize client scripts. You can write and incorporate JavaScript extensions to extend Capture functionality. For more information on JavaScript extensions, see Managing Oracle WebCenter Enterprise Capture.
This chapter includes the following sections:
Client scripts are JavaScript modules that enable you to customize the behavior of certain client events.
This section describes the following events:
The AttachmentCreated event occurs after an attachment has been created.
Syntax | Parameter |
---|---|
|
AttachmentCreatedEvent event |
The AttachmentRemoved event occurs after an attachment has been removed.
Syntax | Parameter |
---|---|
|
AttachmentRemoveEvent event |
The AttachmentSelected event occurs when an attachment has been selected.
Syntax | Parameter |
---|---|
|
AttachmentSelectedEvent event |
The BatchScanBegin event occurs when scanning into a batch is about to begin.
Syntax | Parameter |
---|---|
|
BatchScanEvent event |
The BatchScanComplete event occurs when scanning into a batch is complete.
Syntax | Parameter |
---|---|
|
BatchScanEvent event |
The BatchSelected event occurs when a batch has been selected.
Syntax | Parameter |
---|---|
|
BatchScanEvent event |
The CaptureImage event occurs when an image is about to be captured from the scan source.
Syntax | Parameter |
---|---|
|
ImageCaptureEvent event |
The CaptureInitialize event occurs prior to images being captured, and it can be used to initialize properties of the Capture source.
Syntax | Parameter |
---|---|
|
ImageCaptureEvent event |
The DBSearchComplete event occurs when the database search is completed and before the results are being processed.
Syntax | Parameter |
---|---|
|
DBSearchEvent event |
The DBSearchResults event occurs as database search results are being processed.
Syntax | Parameter |
---|---|
|
DBSearchEvent event |
The DBSearchStart event occurs just before a database search.
Syntax | Parameter |
---|---|
|
DBSearchEvent event |
The DocumentCreated event occurs after a document has been created.
Syntax | Parameter |
---|---|
|
CaptureDocument document |
The DocumentRemoved event occurs after a document has been removed.
Syntax | Parameter |
---|---|
|
DocumentRemoveEvent event |
The DocumentSelected event occurs when a document has been selected.
Syntax | Parameter |
---|---|
|
DocumentSelectedEvent event |
The FieldGotFocus event occurs when a metadata field receives the input focus.
Syntax | Parameter |
---|---|
|
FieldEvent event |
The FieldLostFocus event occurs when a field has lost the input focus.
Syntax | Parameter |
---|---|
|
FieldEvent event |
The FieldProcessKey event occurs when a key event happens while the focus is in a metadata field.
Syntax | Parameter |
---|---|
|
FieldEvent event |
The InitializeFields event occurs before the dataFields model is initialized.
Syntax | Parameter |
---|---|
|
InitializeFieldsEvent event |
The PageCreated event occurs when a page is being added to a document.
Syntax | Parameter |
---|---|
|
PageCreatedEvent event |
The PreBatchDelete event occurs when a batch is about to be deleted.
Syntax | Parameter |
---|---|
|
BatchDeleteEvent event |
The PreBatchScan event occurs before a batch is about to be scanned.
Syntax | Parameter |
---|---|
|
BatchScanEvent event |
The PreCaptureImage event occurs before an image has been captured from the scan source.
Syntax | Parameter |
---|---|
|
ImageCaptureEvent event |
The PreDownloadItem event occurs when a batch item is about to be downloaded.
Syntax | Parameter |
---|---|
|
DownloadItemEvent event |
The PrePageDelete event occurs when one or more pages are about to be deleted.
Syntax | Parameter |
---|---|
|
PageDeleteEvent event |
The PreReleaseBatch event occurs when a batch is about to be released.
Syntax | Parameter |
---|---|
|
ReleaseBatchEvent event |
The PreUploadItem event occurs when a batch item is about to be uploaded.
Syntax | Parameter |
---|---|
|
UploadItemEvent event |
The PostCaptureImage event occurs after an image has been captured from the scan source.
Syntax | Parameter |
---|---|
|
ImageCaptureEvent event |
The PostDownloadItem event occurs after a batch item has been downloaded.
Syntax | Parameter |
---|---|
|
DownloadItemEvent event |
The PostUploadItem event occurs after a batch item has been uploaded.
Syntax | Parameter |
---|---|
|
UploadItemEvent event |
The RegionSelected event occurs when a region has been selected on a document page.
Syntax | Parameter |
---|---|
|
RegionSelectedEvent event |
An event class is used to define an event. This section describes the following event classes:
The AttachmentCreatedEvent class is used in events that occur when an attachment has been created.
Property | Type | Description |
---|---|---|
attachment |
The attachment that has been created. |
The AttachmentRemoveEvent class is used in events that occur when a user removes one or more attachments from a document.
Property | Type | Description |
---|---|---|
attachments |
List<CaptureAttachment> |
The attachments being removed from the document. |
The AttachmentSelectedEvent class is used in events that occur when a user selects an attachment.
Property | Type | Description |
---|---|---|
attachment |
The attachment that has been selected in the batch pane. |
The BatchDeleteEvent class is used in events that occur when a user deletes a batch.
Property | Type | Description |
---|---|---|
batches |
List<CaptureBatch> |
List of batches that will be deleted. |
canceled |
boolean |
If set to True, the delete operation will be canceled. |
The BatchScanEvent class is used in events that occur when a user scans a batch.
Property | Type | Description |
---|---|---|
batch |
The batch that new items will be added to during scan or import. |
|
canceled |
boolean |
If set to True, the scan or import will be canceled. |
sourceFiles |
List<File> |
When using the Import Source, this contains the list of files being imported. |
operation |
Indicates the operation that triggered this event. |
|
allowConfiguration |
boolean |
Setting this property to True in the PreBatchScan event allows scanners to display their configuration dialog, before the first page is scanned. |
The BatchSelectedEvent class is used in events that occur when a user selects a batch.
Property | Type | Description |
---|---|---|
batch |
Batch that has been selected in the batch pane. |
The DBSearchEvent class is used in events that occur when a user initiates a database lookup.
Property | Type | Description |
---|---|---|
displayHitlist |
boolean |
If set to True, displays the database lookup results. |
exactMatch |
boolean |
If set to True, the search value must be an exact match. |
metadataID |
String |
Unique identifier of the metadata field being searched. |
metadataValue |
String |
Value of the metadata field being searched. |
rowResults |
List<DbSearchResultRow> |
List of row results returned from the search. |
canceled |
boolean |
If set to True, cancels the search. |
The DocumentRemoveEvent class is used in events that occur when a user removes a document from the batch.
Property | Type | Description |
---|---|---|
documents |
List<CaptureDocument> |
A list of documents being removed from the batch. |
destinationDocument |
When removing a document separation, this property contains the document to which all pages are to be moved. |
The following table describes the syntax for isRemove() method:
Syntax | Description |
---|---|
|
Returns True if a document separation is being removed. |
The following table describes the syntax for isDelete() method:
Syntax | Description |
---|---|
|
Returns True if the list of documents is being deleted. |
The DocumentSelectedEvent class is used in events that occur when a user selects a document.
Property | Type | Description |
---|---|---|
document |
The document that has been selected in the batch pane. |
The DownloadItemEvent class is used in events that occur when batch items are downloaded from the server.
Property | Type | Description |
---|---|---|
captureItem |
After a batch is opened, indicates the current item being downloaded from the server. |
The FieldEvent class is used in events that occur when a user enters a field, exits a field, or types into a field.
Property | Type | Description |
---|---|---|
cancel |
Boolean |
If set to True, cancels the event. |
field |
The field this event is acting upon. |
|
keyEvent |
KeyEvent |
The keyboard event used to generate this event. |
traversalDirection |
Integer |
Indicates which direction the field focus is moving. TRAVERSAL Constants:
|
The ImageCaptureEvent class is used in events that occur when the user is capturing an image.
Property | Type | Description |
---|---|---|
cancel |
boolean |
If set to True, the capture operation will be canceled. |
imageCount |
Integer |
Indicates how many images have been captured. |
imageFileName |
String |
Indicates the file name of image saved locally. |
xdpi |
Integer |
For images, indicates the horizontal dots per inch. |
ydpi |
Integer |
For images, indicates the vertical dots per inch. |
brightness |
Integer |
The brightness value used to capture the image. |
contrast |
Integer |
The contrast value used to capture the image. |
logicalBreak |
boolean |
If set to True, indicates the start of a document. |
sourceFiles |
List<File> |
When using the Import Source, contains the list of files being imported. |
sourceFileName |
String |
When using the Import Source, contains the name of the source file being imported. |
image |
BufferedImage |
For images files, contains a BufferedImage object. |
source |
The ImageCaptureEngine that created this event. |
|
imageFormat |
ImageCaptureEngine.ImageFormat |
Indicates the format that images will be saved as Available Formats: tiffG4, tiffJpegGray, tiffJpegColor, jpegGray, and jpegColor. |
printerString |
String [ ] |
The imprinter or endorser strings printed on a page during capture. |
The InitializeFieldsEvent class is used in events that occur before the fieldedit control is initialized on the client. You can use this class to modify or remove the DataFields from the list.
Property | Type | Description |
---|---|---|
dataFields |
List <DataField> |
The list of DataFields that will be displayed to the user. |
The PageCreatedEvent class is used when a page is created.
Property | Type | Description |
---|---|---|
page |
The page that was created. |
The PageDeleteEvent class is used when a page is being deleted.
Property | Type | Description |
---|---|---|
pages |
List<CaptureDocumentPage> |
The list of pages being deleted. You can modify this list to remove pages that you do not want to delete. |
canceled |
boolean |
If set to True, no pages will be deleted. |
The RegionSelectedEvent class is used in events that occur when a user selects a region of the image in the viewer.
Property | Type | Description |
---|---|---|
mouseEvent |
MouseEvent |
The MouseEvent used to select the region within the image. |
selectionRectangle |
Rectangle |
The rectangle selected within the image. |
image |
BufferedImage |
The BufferedImage containing the selected portion of the image. |
The ReleaseBatchEvent class is used in events that occur when a batch is about to get released or unlocked.
Property | Type | Description |
---|---|---|
batches |
List<CaptureBatch> |
The list of batches that are about to be released. |
processorID |
String |
The unique identifier of the processor to which the batches will get released. |
jobID |
String |
The unique identifier of the processor job. |
canceled |
boolean |
If the flag is set to True, the release will be canceled. |
releaseProcessName |
String |
The name of the process used to release the batch. |
This section describes the following Capture Client Core classes:
The AttachmentType class contains all properties of an attachment type.
Property | Type | Description |
---|---|---|
ID |
String |
The internal identifier for the attachment type. |
name |
String |
The name for the attachment type. |
description |
String |
The description for the attachment type. |
required |
Boolean |
Indicates if the attachment type is required. |
The AttachmentTypes class is a map of attachment types. It is of type LinkedHashMap<String, AttachmentType> and the map key is the attachment type ID. Use the LinkedHashMap methods to retrieve the attachment types from instances of this class.
See the Java API documentation for more information on the LinkedHashMap class and its methods.
The BarcodeInfo class contains all the properties associated with a bar code detected by a scanner.
Property | Type | Description |
---|---|---|
type |
Integer |
The type of the bar code. Valid bar code types are:
|
text |
String |
The textual value of the bar code. |
x |
Integer |
The horizontal location (in pixels) of the bar code on the page. This value may be null if the scanner does not supply this information. |
y |
Integer |
The vertical location (in pixels) of the bar code on the page. This value may be null if the scanner does not supply this information. |
confidence |
Integer |
The degree of certainty in the accuracy of the bar code information. The value ranges from 0 (no confidence) to 100 (supreme confidence) or may be null or (-)1 if the scanner does not supply this information. |
rotation |
Integer |
The orientation of the bar code. Valid orientations are:
This value may be null if the scanner does not supply this information. |
The CaptureAttachment class contains all properties of an attachment.
Property | Type | Description |
---|---|---|
attachmentType |
The type of attachment. |
|
id |
String |
The internal identifier for the attachment. |
pages |
The pages contained in the attachment. |
|
parentDocument |
The parent document owning this attachment. |
|
title |
String |
The title of the attachment. |
The following table describes the syntax for persist() method:
Syntax | Description |
---|---|
|
Saves the attachment and related document pages to the server. |
The CaptureAttachments class is a collection of attachments and is of type Vector<CaptureAttachment>. Use the Vector methods to retrieve attachments from instances of this class.
See the Java API documentation for more information on the Vector class and its methods.
The CaptureBatch class contains all properties and operations for a batch.
Property | Type | Description |
---|---|---|
batchId |
String |
The internal identifier for the batch. |
batchName |
String |
The name of the batch. |
batchPath |
String |
The local path where information for this batch is stored. |
createdBy |
String |
The user that created the batch. |
createdDate |
Date |
The date that the batch was created. |
currentPriority |
Integer |
The priority assigned to the batch. |
currentStatus |
The status assigned to the batch. |
|
documents |
The documents contained in the batch. |
|
items |
The items associated with the batch. |
|
jobID |
String |
ID of the processor job. This property is populated just before the batch is released. |
lastModifiedDate |
Date |
The date that the batch was last modified. |
note |
String |
The note assigned to the batch. |
processorID |
String |
ID of the processor to which the batch will get released. This property is populated just before the batch is released. |
workspace |
The workspace used to create the batch. |
The following table describes the syntax for persist() method:
Syntax | Description |
---|---|
|
Saves the batch record to the server. |
The CaptureBatchStatus class contains the properties of a batch status.
Property | Type | Description |
---|---|---|
value |
String |
The description of the status. |
id |
String |
The internal identifier of the status. |
The CaptureDataType is an enumeration that defines the data types for metadata field definitions. The following are valid Capture data types:
NUMERIC
ALPHA
ALPHANUMERIC
DATE
FLOAT
The CaptureDocument class contains all properties of a document.
Property | Type | Description |
---|---|---|
documentType |
The document profile assigned to the document. |
|
fields |
The metadata assigned to the document. |
|
id |
String |
The internal identifier for the document. |
pages |
The pages contained in the document. |
|
parentBatch |
The batch that contains this document. |
|
title |
String |
The title of the document. |
attachments |
The attachments associated with this document. |
The following table describes the syntax for persist() method:
Syntax | Description |
---|---|
|
Saves the document, related document pages, and metadata to the server. |
The CaptureDocumentPage class contains the properties of a document page.
Property | Type | Description |
---|---|---|
imageFilenameKey |
String |
The local filename for this page. |
item |
The item associated with the page. |
|
pageID |
String |
The internal identifier for the page. |
pageNumber |
Integer |
The number of the page within the document. |
parentDocument |
The document that contains this page. |
The CaptureDocumentPages class is a collection of document pages and is of type Vector<CaptureDocumentPage>. Use the Vector methods to retrieve document pages from instances of this class.
See the Java API documentation for more information on the Vector class and its methods.
The CaptureDocuments class is a collection of documents and is of type Vector<CaptureDocument>. Use the Vector methods to retrieve documents from instances of this class.
See the Java API documentation for more information on the Vector class and its methods.
The CaptureErrorManager class manages what error messages are logged.
Property | Type | Description |
---|---|---|
logLevel |
Level |
The minimum level used to log messages. |
The following table describes the syntax for logMessage() method:
Syntax | Description |
---|---|
|
Logs a message with the specified log level. or Logs a message and error with the specified log level. |
The following table describes the parameters for logMessage() method:
Parameter | Type | Description |
---|---|---|
level |
Level |
The severity level for this log entry. |
message |
String |
The message you wish to log. |
errorException |
Throwable |
If logging an error, the exception that is the cause of the error. |
The CaptureField class contains the properties of a document metadata field.
Property | Type | Description |
---|---|---|
displayValue |
String |
The value to display for this field. |
fieldName |
String |
The name of the field. |
length |
Integer |
The maximum length of the field. |
required |
boolean |
If True, this field is required to have a value. |
value |
String |
The value for this field. |
The following table describes the syntax for setDate() method:
Syntax | Description |
---|---|
|
Sets the value of the metadata field to a date. |
The following table describes the parameters for setDate() method:
Parameter | Type | Description |
---|---|---|
date |
Date |
The date value to be set. |
The CaptureFields class is a map of metadata field definitions. It is of type LinkedHashMap<String, CaptureField> and the map key is the field name. Use the LinkedHashMap methods to retrieve the fields from instances of this class.
See the Java API documentation for more information on the LinkedHashMap class and its methods.
The CaptureItem class contains properties of an item (single image or non-image file) associated with a document page.
Property | Type | Description |
---|---|---|
filename |
String |
The name of the file for this item. |
parentBatch |
The batch containing this item. |
|
sourceFilename |
String |
If this item was imported, contains the name of the file it was imported from. |
sourceFormat |
String |
Non-image documents contains the format of the document, which is typically the file extension. |
patchCode |
Integer |
The patch code for this item. |
barcodes |
List<String> |
The bar codes for this item. |
micrValue |
String |
The scanner's MICR text for this item. |
endorsement |
String |
The scanner's endorsement text for this item. |
The following table describes the syntax for persist() method:
Syntax | Description |
---|---|
|
Saves the item to the server. |
The CaptureItems class is a map of Capture items. It is of type TreeMap<String, CaptureItem> and the map key is the item filename. Use the TreeMap methods to retrieve the items from instances of this class.
See the Java API documentation for more information on the TreeMap class and its methods.
This is an enumeration that defines the capture operation being performed on the batch. The following are valid Capture operation values:
Create
Append
Insert
Replace
The CaptureStateManager class contains properties related to the current state of the client. The instance of this class is available to all scripting events through the Capture property.
Property | Type | Description |
---|---|---|
activeAttachment |
The active document attachment. |
|
activeAttachmentPage |
The active document attachment page. |
|
activeAttachmentType |
The active document attachment type. |
|
activeBatch |
The active batch. |
|
activeDocument |
The active document. |
|
activeDocumentPage |
The active document page. |
|
activeDocumentType |
The active document profile. |
|
activeProfile |
The active client profile. |
|
applicationUserPath |
String |
The path the client uses for its application data. |
batchesPath |
String |
The path the client uses to cache batch data. |
captureSystemId |
String |
The internal identifier of the Capture system that the client is connected to. |
computerName |
String |
The name of the computer the client is running on. |
currentUser |
String |
The user currently logged into the client. |
errorManager |
The Error Manager object used for logging information. |
The CaptureWorkspace class contains all properties and operations for a workspace.
Property | Type | Description |
---|---|---|
id |
String |
The internal identifier associated with the workspace. |
fieldDefinitions |
The metadata defined for this workspace. |
|
name |
String |
The name of the workspace. |
statuses |
List<CaptureBatchStatus> |
A list of batch statuses available to this workspace. |
The following table describes the syntax for getDBLookupProfile() method:
Syntax | Description |
---|---|
|
Retrieves the database lookup profile for the given database lookup profile ID. |
The following table describes the parameter for getDBLookupProfile() method:
Parameter | Type | Description |
---|---|---|
profileId |
String |
The identifier of the database lookup profile. |
The ClientProfile class contains the properties of a client profile as defined in the Capture Workspace Console.
Property | Type | Description |
---|---|---|
alwaysDisplayHitList |
boolean |
If True, after a database lookup is executed, the results are displayed regardless of the number of results returned. |
applyBrightness |
boolean |
If True, applies the brightness and contrast settings to the selected Capture source. |
batchFilterDaysOldFrom |
Integer |
A batch filter setting that specifies the minimum days old a batch can be. |
batchFilterDaysOldTo |
Integer |
A batch filter setting that specifies the maximum days old a batch can be. |
batchFilterPrimarySortField |
String |
The batch property used for the primary sort of the batches tree. |
batchFilterPrimarySortOrder |
The primary sort order for the batches tree. |
|
batchFilterSecondarySortField |
String |
The batch property used for the secondary sort of the batches tree. |
batchFilterSecondarySortOrder |
The secondary sort order for the batches tree. |
|
batchFilterState |
Integer |
The batch states to include in the batch filter. |
batchPrefix |
String |
The batch prefix to use for batches created using this profile. |
batchVisibility |
A batch filter setting that specifies when a user sees the batch in the batches tree. |
|
blankByteThreshold |
long |
If the number of bytes in the file size of an image is less than the blankByteThreshold, the page is considered to be a blank page. |
brightness |
Integer |
The brightness to apply to the selected Capture source. |
captureType |
Indicates whether the profile is capture-only, capture and index, or index-only. |
|
contrast |
Integer |
The contrast to apply to the selected Capture source. |
dBLookupMaxRecords |
Integer |
The maximum number of records to return from a database lookup. |
dBLookupProfileId |
String |
The unique identifier of the database lookup profile used by this profile. |
defaultColor |
The default color type used during capture. |
|
defaultDpi |
Integer |
The default DPI to use during capture. |
defaultPriority |
Integer |
A batch created from this profile will be assigned this priority. |
defaultStatusId |
String |
A batch created from this profile will be assigned this status. |
description |
String |
The description for the profile. |
documentCreationType |
Specifies how many pages are created per document at capture time. |
|
documentTypes |
An object containing the document profiles that this profile can assign to a batch. |
|
id |
String |
The identifier associated with this profile. |
maxPages |
Integer |
The non-image file preview page limit. |
name |
String |
The name of the profile. |
nonImageAction |
The action to take for non-image files. |
|
nonImageDpi |
int |
For client profiles having a nonImageAction property of type CONVERT, this property contains the image DPI for non-image files. |
nonImageFormat |
String |
For client profiles having a nonImageAction property of type CONVERT, this property contains the image format for non-image files. This value will be either TIFF_BW or JPEG. |
nonImageJpegQuality |
int |
For client profiles having a nonImageAction property of type CONVERT and a nonImageFormat value of JPEG, this property contains the JPEG image quality for non-image files. |
picklistRelationshipProfile |
String |
The dependent choice list used by this profile. |
prefixes |
List<String> |
The batch prefixes used in the batch filter. |
preventDefaultColorOverride |
boolean |
If True, the color cannot be overridden. |
preventDefaultDpiOverride |
boolean |
If True, the dpi cannot be overridden. |
priorities |
List<Integer> |
The batch priorities used in the batch filter. |
sepByteThreshold |
Integer |
If the number of bytes in the file size of an image is less than the sepByteThreshold, the page is considered to be a separator sheet. |
statuses |
List<String> |
The batch statuses used in the batch filter. |
supportedDocumentTypes |
List<String> |
A list of document profile identifiers which represent the document profiles that this profile can assign to a batch. |
workspaceId |
String |
The unique identifier of the workspace in which this profile is associated. |
workspaceName |
String |
The name of the workspace in which this profile is associated. |
releaseProcesses |
A list of the available client release processes. |
The following table describes the enumeration and values for the ClientProfile class:
Enumeration | Value |
---|---|
AutoPopulateType |
NONE, SCANDATE, INDEXDATE, DEFAULTVALUE, BATCHNAME, USERID, COMPUTERNAME, CLIENTPROFILENAME, BATCHSTATUS, BATCHPRIORITY |
BatchVisibility |
USER_AND_COMPUTER, USER, ALL |
DocumentCreationType |
ONE_PAGE, TWO_PAGES, VARIABLE_PAGES, PROMPT_USER |
CaptureType |
CAPTURE_ONLY, CAPTURE_AND_INDEX, INDEX_ONLY |
NonImageAction |
DISALLOW, ALLOW, CONVERT |
SortOrder |
ASCENDING, DESCENDING |
ColorType |
NotSpecified, BlackAndWhite, Gray, Color |
The ClientReleaseProcess class contains all properties of a client release process.
Property | Type | Description |
---|---|---|
name |
String |
The name of the release process. |
description |
String |
The description of the release process. |
processorID |
String |
The processor ID of the release process. |
jobID |
String |
The processor job ID of the release process. |
defaultRelease |
boolean |
Indicates if this is the default release process. |
The ClientReleaseProcesses class is a list of client release processes. It is of type ArrayList<ClientReleaseProcess>. Use the ArrayList methods to retrieve the client release processes from instances of this class.
See the Java API documentation for more information on the ArrayList class and its methods.
The ClientUI class allows the user to invoke user interface related actions and can be accessed through client scripts.
Property | Type | Description |
---|---|---|
batchEditForm |
BatchEditForm |
An instance of the current batch edit form. |
This class includes the following methods:
releaseBatch()
The following table describes the syntax for releaseBatch() method:
Syntax | Description |
---|---|
|
Unlocks or releases a list of batches for further processing. |
The following table describes the parameters for releaseBatch() method:
Parameter | Type | Description |
---|---|---|
batches |
List<CaptureBatch> |
The list of batches to be released. |
processorID |
String |
The unique identifier of the processor to which the batches will get released. |
jobID |
String |
The unique identifier of the processor job. |
setActiveMetadataFieldByName()
The following table describes the syntax for setActiveMetadataFieldByName() method:
Syntax | Description |
---|---|
|
Moves the focus in the metadata pane to the metadata field specified by the field name. |
The following table describes the parameter for setActiveMetadataFieldByName() method:
Parameter | Type | Description |
---|---|---|
fieldName |
String |
The name of the metadata field to which the focus is to be moved. |
setActiveMetadataFieldByID()
The following table describes the syntax for setActiveMetadataFieldByID() method:
Syntax | Description |
---|---|
|
Moves the focus in the metadata pane to the metadata field name specified by the field ID. |
The following table describes the parameter for setActiveMetadataFieldByID() method:
Parameter | Type | Description |
---|---|---|
fieldID |
String |
The unique identifier of the metadata field to which the focus is to be moved. |
execDBSearch()
The following table describes the syntax for execDBSearch() method:
Syntax | Description |
---|---|
|
Performs a database lookup for the given metadata field name and value. This method then updates the metadata fields in the metadata pane with the results. |
The following table describes the parameters for execDBSearch() method:
Parameter | Type | Description |
---|---|---|
metadataName |
String |
The name of the metadata field that is to be looked up. |
metadataValue |
String |
The value that is used to perform the lookup. |
alwaysDisplayHitList |
Boolean |
If set to True, displays the lookup results irrespective of the number of results. |
execDBSearch()
The following table describes the syntax for execDBSearch() method:
Syntax | Description |
---|---|
|
Performs a database lookup for the given metadata field name and value. This method then updates the metadata fields in the metadata pane with the results. |
The following table describes the parameters for execDBSearch() method:
Parameter | Type | Description |
---|---|---|
metadataName |
String |
The name of the metadata field that is to be looked up. |
metadataValue |
String |
The value that is used to perform the lookup. |
alwaysDisplayHitList |
Boolean |
If set to True, displays the lookup results irrespective of the number of results. |
exactSearch |
Boolean |
If set to True, the result must exactly match the value being searched. If set to False, partial matches are also returned. |
maximumRecords |
Integer |
Indicates the maximum number of records the search returns. |
selectDocument()
The following table describes the syntax for selectDocument() method:
Syntax | Description |
---|---|
|
Selects the given document in the batches tree. |
The following table describes the parameters for selectDocument() method:
Parameter | Type | Description |
---|---|---|
document |
The document to select. |
refreshDocumentMetadata()
The following table describes the syntax for refreshDocumentMetadata() method:
Syntax | Description |
---|---|
|
Reloads the metadata from the current document and displays it in the metadata pane. |
The DBLookupProfile class represents a profile for database lookup. This class includes the following method:
execDBLookup()
The following table describes the syntax for execDBLookup() method:
Syntax | Description |
---|---|
Database Lookup without sorting
Database Lookup with sorting
|
Executes a database lookup with or without sorting. Sort Constants:
|
The following table describes the parameters for the execDBLookup() method:
Parameter | Type | Description |
---|---|---|
searchID |
String |
The unique identifier of the database search defined for the database lookup profile. |
fieldID |
String |
The unique identifier of the metadata field being searched. |
value |
String |
The value being searched upon. |
exactMatch |
Boolean |
If True, the value must be an exact match. |
primarySortField |
String |
The field identifier used for the primary sort. |
primarySortOrder |
Integer |
The sort order of the primary sort. |
secondarySortField |
String |
The field identifier used for the secondary sort. |
secondarySortOrder |
Integer |
The sort order of the secondary sort. |
maxRows |
Integer |
The maximum number of rows to be returned. |
The DBLookupResult class represents the result of a database lookup.
Property | Type | Description |
---|---|---|
searchFieldInfoList |
List<DbSearchFieldInfo> |
A list of search field information describing the results returned by the database lookup. |
searchResultRows |
List<DbSearchResultRow> |
A list of search result rows returned by the database lookup. |
The DbSearchResultRow class represents one row result returned from a database lookup.
Property | Type | Description |
---|---|---|
results |
List<String> |
A list of string values associated with one search result. The values in the list will be in the same order in which the return fields are defined. |
The DbSearchFieldInfo class represents the field information describing the results of a database lookup.
Property | Type | Description |
---|---|---|
captureIndexDefID |
String |
The metadata field identifier. |
dbColumnName |
String |
The name of the database column. |
dbColumnType |
Integer |
The type of the database column. |
captureFieldType |
Integer |
The data type of the metadata field. |
The DocumentType class represents a document profile. A document profile dictates what metadata fields are available to documents created from this type.
Property | Type | Description |
---|---|---|
fieldDefinitions |
The metadata applicable to the document profile. |
|
id |
String |
The internal identifier associated with the document profile. |
name |
String |
The name for the document profile. |
description |
String |
The description for the document profile. |
attachmentTypes |
The attachment types available to the document profile. |
The DocumentTypes class is a map of document profiles. It is of type TreeMap<String, DocumentType> and the map key is the document profile ID. You can use the TreeMap methods to retrieve the document profiles from instances of this class.
See the Java API documentation for more information on the TreeMap class and its methods.
The FieldDefinition class represents a metadata field's definition.
Property | Type | Description |
---|---|---|
autoPopulateType |
ClientProfile.AutoPopulateType |
Specifies how the field should be auto-populated. |
dataType |
The data type of this field. |
|
autoPopulateDefault |
String |
The default value for this field. |
displayable |
boolean |
Indicates whether this field will be displayed in the client. |
length |
Integer |
The maximum length for this field. |
id |
String |
The internal identifier for this field. |
name |
String |
The name of this field. |
inputMask |
String |
The input mask. |
locked |
boolean |
Set to True, if the field is locked. |
maxValue |
Float |
The maximum value for this field. |
minValue |
Float |
The minimum value for this field. |
pickListCaseInsensitive |
boolean |
If True, the choice list is case insensitive. |
pickListID |
String |
The unique identifier of the choice list associated with this field. |
pickListParentFieldID |
String |
The unique identifier of the choice list parent field. |
pickListSourceID |
String |
The source identifier of the dependent choice list for this field. |
profileDisplayFormat |
String |
The format used when displaying the field. |
required |
boolean |
Indicates whether this field is required to have a value. |
validationExpression |
String |
A regular expression used to validate the values entered for this field. |
The FieldDefinitions class is a map of metadata field definitions. It is of type LinkedHashMap<String, FieldDefinition> and the map key is the metadata field definition ID. You can use the LinkedHashMap methods to retrieve the metadata field definitions from instances of this class.
See the Java API documentation for more information on the LinkedHashMap class and its methods.
The ImageCaptureEngine class contains all the properties and operations associated with image capture.
Property | Type | Description |
---|---|---|
activeSource |
ImageCaptureSource |
The active source of the Image Capture Engine from which to capture images. |
activeDriver |
ImageCaptureDriver |
The active driver of the Image Capture Engine from which to capture images. |
The MicrInfo class contains all the properties associated with the magnetic data detected by a scanner.
Property | Type | Description |
---|---|---|
string |
String |
The textual information read from the MICR data. |
The Source class is a low-level class used to interact with a TWAIN scanner.
This class includes the following methods:
getCurrentPrinter()
The following table describes the syntax for getCurrentPrinter() method:
Syntax | Description |
---|---|
|
Returns the current imprinter or endorser. See the setPrinter(int printer) method for valid values. |
getPrinterIndex()
The following table describes the syntax for getPrinterIndex() method:
Syntax | Description |
---|---|
|
Returns the counter value of the current imprinter or endorser. |
getPrinterMode()
The following table describes the syntax for getPrinterMode() method:
Syntax | Description |
---|---|
|
Returns the mode of the current imprinter or endorser. See the method setPrinterMode(int printerMode) for the meaning of the return value. |
getPrinterString()
The following table describes the syntax for getPrinterString() method:
Syntax | Description |
---|---|
|
Returns the string or format of the current imprinter or endorser. |
getPrinterSuffix()
The following table describes the syntax for getPrinterSuffix() method:
Syntax | Description |
---|---|
|
Returns the suffix string of the current imprinter or endorser. |
getSupportedPrinters()
The following table describes the syntax for getSupportedPrinters() method:
Syntax | Description |
---|---|
|
Returns an array of the supported imprinters or endorsers. See the setPrinter(int printer) method for the meaning of the return values. |
isPrinterEnabled()
The following table describes the syntax for isPrinterEnabled() method:
Syntax | Description |
---|---|
|
Returns whether the current imprinter or endorser is enabled. |
isBarcodeDetectionEnabled()
The following table describes the syntax for isBarcodeDetectionEnabled() method:
Syntax | Description |
---|---|
|
Returns whether bar code detection is enabled for the scanner. |
getBarcodeMaxRetries()
The following table describes the syntax for getBarcodeMaxRetries() method:
Syntax | Description |
---|---|
|
Returns the number of times a search will be retried if no bar codes are found. |
getBarcodeMaxSearchPriorities()
The following table describes the syntax for getBarcodeMaxSearchPriorities() method:
Syntax | Description |
---|---|
|
Returns the maximum number of supported bar code search priorities. |
getBarcodeSearchMode()
The following table describes the syntax for getBarcodeSearchMode() method:
Syntax | Description |
---|---|
|
Returns the orientation or orientation priority used for bar code searching. Possible return values are:
|
getBarcodeTimeout()
The following table describes the syntax for getBarcodeTimeout() method:
Syntax | Description |
---|---|
|
Returns the maximum amount of time to spend searching for bar codes on a page. |
getBarcodeSearchPriorities()
The following table describes the syntax for getBarcodeSearchPriorities() method:
Syntax | Description |
---|---|
|
Returns a prioritized array of bar code types dictating the order in which they will be sought. Valid bar code types are: TWBT_3OF9, TWBT_2OF5INTERLEAVED, TWBT_2OF5NONINTERLEAVED, TWBT_CODE93, TWBT_CODE128, TWBT_UCC128, TWBT_CODABAR, TWBT_UPCA, TWBT_UPCE, TWBT_EAN8, TWBT_EAN13, TWBT_POSTNET, TWBT_PDF417, TWBT_2OF5INDUSTRIAL, TWBT_2OF5MATRIX, TWBT_2OF5DATALOGIC, TWBT_2OF5IATA, TWBT_3OF9FULLASCII, TWBT_CODABARWITHSTARTSTOP, TWBT_MAXICODE For definitions of valid bar code types, see BarcodeInfo. |
getSupportedBarcodeTypes()
The following table describes the syntax for getSupportedBarcodeTypes() method:
Syntax | Description |
---|---|
|
Returns an array of the bar code types supported by the scanner. Valid bar code types are: TWBT_3OF9, TWBT_2OF5INTERLEAVED, TWBT_2OF5NONINTERLEAVED, TWBT_CODE93, TWBT_CODE128, TWBT_UCC128, TWBT_CODABAR, TWBT_UPCA, TWBT_UPCE, TWBT_EAN8, TWBT_EAN13, TWBT_POSTNET, TWBT_PDF417, TWBT_2OF5INDUSTRIAL, TWBT_2OF5MATRIX, TWBT_2OF5DATALOGIC, TWBT_2OF5IATA, TWBT_3OF9FULLASCII, TWBT_CODABARWITHSTARTSTOP, TWBT_MAXICODE For definitions of valid bar code types, see BarcodeInfo. |
getBarcodesDetected()
The following table describes the syntax for getBarcodesDetected() method:
Syntax | Description |
---|---|
|
Returns an array of BarcodeInfo objects describing the bar codes found on the current page by the scanner. |
isPatchCodeDetectionEnabled()
The following table describes the syntax for isPatchCodeDetectionEnabled() method:
Syntax | Description |
---|---|
|
Returns whether the patch code detection is enabled for the scanner. |
getPatchCodeMaxRetries()
The following table describes the syntax for getPatchCodeMaxRetries() method:
Syntax | Description |
---|---|
|
Returns the number of times a search will be retried if no patch codes are found. |
getPatchCodeMaxSearchPriorities()
The following table describes the syntax for getPatchCodeMaxSearchPriorities() method:
Syntax | Description |
---|---|
|
Returns the maximum number of supported patch code search priorities. |
getPatchCodeSearchMode()
The following table describes the syntax for getPatchCodeSearchMode() method:
Syntax | Description |
---|---|
|
Returns the orientation or orientation priority used for patch code searching. Possible return values are: TWBD_HORZ, TWBD_VERT, TWBD_HORZVERT, TWBD_VERTHORZ For definitions of possible return values, see getBarcodeSearchMode(). |
getPatchCodeTimeout()
The following table describes the syntax for getPatchCodeTimeout() method:
Syntax | Description |
---|---|
|
Returns the maximum amount of time to spend searching for patch codes on a page. |
getPatchCodeSearchPriorities()
The following table describes the syntax for getPatchCodeSearchPriorities() method:
Syntax | Description |
---|---|
|
Returns a prioritized array of patch code types dictating the order in which they will be sought. Valid patch code types are:
|
getSupportedPatchCodeTypes()
The following table describes the syntax for getSupportedPatchCodeTypes() method:
Syntax | Description |
---|---|
|
Returns an array of the patch code types supported by the scanner. Valid patch code types are: TWPCH_PATCH1, TWPCH_PATCH2, TWPCH_PATCH3, TWPCH_PATCH4, TWPCH_PATCH6, TWPCH_PATCHT For definitions of valid patch code types, see getPatchCodeSearchPriorities(). |
getPatchCodesDetected()
The following table describes the syntax for getPatchCodesDetected() method:
Syntax | Description |
---|---|
|
Returns an array containing the first patch code type found on the current page by the scanner. The return value may be null or an empty array if no patch codes were detected. Valid patch code types are: TWPCH_PATCH1, TWPCH_PATCH2, TWPCH_PATCH3, TWPCH_PATCH4, TWPCH_PATCH6, TWPCH_PATCHT For definitions of valid patch code types, see getPatchCodeSearchPriorities(). |
isMicrEnabled()
The following table describes the syntax for isMicrEnabled() method:
Syntax | Description |
---|---|
|
Returns whether MICR detection is enabled for the scanner. |
getMicrDetected()
The following table describes the syntax for getMicrDetected() method:
Syntax | Description |
---|---|
|
Returns a MicrInfo object describing the magnetic data found on the current page by the scanner. |
setPrinter(int printer)
The following table describes the syntax for setPrinter(int printer) method:
Syntax | Description |
---|---|
|
Sets the current imprinter or endorser. Valid values are:
|
setPrinterIndex(int printerIndex)
The following table describes the syntax for setPrinterIndex(int printerIndex) method:
Syntax | Description |
---|---|
|
Sets the counter value of the current imprinter or endorser. |
setPrinterMode(int printerMode)
The following table describes the syntax for setPrinterMode(int printerMode) method:
Syntax | Description |
---|---|
|
Sets the mode of the current imprinter or endorser. Valid values are:
|
setPrinterString(String printerString)
The following table describes the syntax for setPrinterString(String printerString) method:
Syntax | Description |
---|---|
|
Sets the string or format of a single line to be printed to the current imprinter or endorser. |
setPrinterString(String[ ] printerString)
The following table describes the syntax for setPrinterString(String[ ] printerString) method:
Syntax | Description |
---|---|
|
Sets the format of one or more lines (if capable) to be printed to the current imprinter or endorser. |
setPrinterSuffix(String printerSuffix)
The following table describes the syntax for setPrinterSuffix(String printerSuffix) method:
Syntax | Description |
---|---|
|
Sets the suffix for the current imprinter or endorser. (Compound string mode only). |
setBarcodeDetectionEnabled(boolean enabled)
The following table describes the syntax for setBarcodeDetectionEnabled(boolean enabled) method:
Syntax | Description |
---|---|
|
Enables or disables bar code detection for the scanner. |
setBarcodeMaxRetries(int maxRetries)
The following table describes the syntax for setBarcodeMaxRetries(int maxRetries) method:
Syntax | Description |
---|---|
|
Restricts the number of times a search will be retried if no bar codes are found. |
setBarcodeMaxSearchPriorities(int maxSearchPriorities)
The following table describes the syntax for setBarcodeMaxSearchPriorities(int maxSearchPriorities) method:
Syntax | Description |
---|---|
|
Specifies the maximum number of supported bar code search priorities. |
setBarcodeSearchMode(int searchMode)
The following table describes the syntax for setBarcodeSearchMode(int searchMode) method:
Syntax | Description |
---|---|
|
Restricts bar code searching to certain orientations, or prioritizes one orientation over another. Valid values are: TWBD_HORZ, TWBD_VERT, TWBD_HORZVERT, TWBD_VERTHORZ For definitions of valid values, see getBarcodeSearchMode(). |
setBarcodeTimeout(int timeout)
The following table describes the syntax for setBarcodeTimeout(int timeout) method:
Syntax | Description |
---|---|
|
Restricts the total time spent on searching for bar codes on a page. |
setBarcodeSearchPriorities(int[] value)
The following table describes the syntax for setBarcodeSearchPriorities(int[] value) method:
Syntax | Description |
---|---|
|
Sets a prioritized array of bar code types dictating the order in which they will be sought. Valid bar code types are: TWBT_3OF9, TWBT_2OF5INTERLEAVED, TWBT_2OF5NONINTERLEAVED, TWBT_CODE93, TWBT_CODE128, TWBT_UCC128, TWBT_CODABAR, TWBT_UPCA, TWBT_UPCE, TWBT_EAN8, TWBT_EAN13, TWBT_POSTNET, TWBT_PDF417, TWBT_2OF5INDUSTRIAL, TWBT_2OF5MATRIX, TWBT_2OF5DATALOGIC, TWBT_2OF5IATA, TWBT_3OF9FULLASCII, TWBT_CODABARWITHSTARTSTOP, TWBT_MAXICODE For definitions of valid bar code types, see BarcodeInfo. |
setPatchCodeDetectionEnabled(boolean enabled)
The following table describes the syntax for setPatchCodeDetectionEnabled(boolean enabled) method:
Syntax | Description |
---|---|
|
Enables or disables patch code detection for the scanner. |
setPatchCodeMaxRetries(int maxRetries)
The following table describes the syntax for setPatchCodeMaxRetries(int maxRetries) method:
Syntax | Description |
---|---|
|
Restricts the number of times a search will be retried if no patch codes are found. |
setPatchCodeMaxSearchPriorities(int maxSearchPriorities)
The following table describes the syntax for setPatchCodeMaxSearchPriorities(int maxSearchPriorities) method:
Syntax | Description |
---|---|
|
Specifies the maximum number of supported patch code search priorities. |
setPatchCodeSearchMode(int searchMode)
The following table describes the syntax for setPatchCodeSearchMode(int searchMode) method:
Syntax | Description |
---|---|
|
Restricts patch code searching to certain orientations, or prioritizes one orientation over another. Valid values are: TWBD_HORZ, TWBD_VERT, TWBD_HORZVERT, TWBD_VERTHORZ For definitions of valid values, see getBarcodeSearchMode(). |
setPatchCodeTimeout(int timeout)
The following table describes the syntax for setPatchCodeTimeout(int timeout) method:
Syntax | Description |
---|---|
|
Restricts the total time spent on searching for patch codes on a page. |
setPatchCodeSearchPriorities(int[] value)
The following table describes the syntax for setPatchCodeSearchPriorities(int[] value) method:
Syntax | Description |
---|---|
|
Sets a prioritized array of patch code types dictating the order in which they will be sought. Valid patch code types are: TWPCH_PATCH1, TWPCH_PATCH2, TWPCH_PATCH3, TWPCH_PATCH4, TWPCH_PATCH6, TWPCH_PATCHT For definitions of valid patch code types, see getPatchCodeSearchPriorities(). |
setMicrEnabled(boolean enabled)
The following table describes the syntax for setMicrEnabled(boolean enabled) method:
Syntax | Description |
---|---|
|
Enables or disables MICR detection for the scanner. |
The FieldEdit class is the user interface component for entering metadata values. This section describes the following Capture Client FieldEdit classes:
The DataField class represents the data for a single field of the FieldEdit component and is the base class for the various field types.
Property | Type | Description |
---|---|---|
caption |
String |
The field caption. |
fieldName |
String |
The field name. |
displayFormat |
Format |
The display format for the field. |
inputMask |
String |
The input mask. |
fieldLock |
boolean |
If True, the field is locked. |
maxLength |
Long |
The maximum length of the field. |
required |
boolean |
If True, this field is required to be entered. |
uncommittedText |
String |
The current text in the field. |
The DataField class extends from DataField and represents a date field.
Property | Type | Description |
---|---|---|
value |
Date |
The value, represented by a Date object. |
This FloatField class extends from DataField and represents a float field.
Property | Type | Description |
---|---|---|
value |
Float |
The value, represented by a Float object. |
The IntegerField class extends from DataField and represents an integer field.
Property | Type | Description |
---|---|---|
value |
Integer |
The value, represented by an Integer object. |
The PicklistEntry class is used in picklist-type fields to determine the display and commit values. This class includes the following methods:
getCommitValue()
The following table describes the syntax for getCommitValue() method:
Syntax | Description |
---|---|
|
Returns the commit value of the choice list entry. |
getDisplayValue()
The following table describes the syntax for getDisplayValue() method:
Syntax | Description |
---|---|
|
Returns the display value of the choice list entry. |
The PicklistField class extends from DataField and represents a Pick-list (Choice List) field.
Property | Type | Description |
---|---|---|
pickListCaseSensitive |
boolean |
If True, the contents of this list are sensitive to case. |
pickListEntries |
List<PicklistEntry> |
The list of entries in the choice list. |
value |
The current value of the choice list. |
The section describes the following sample client scripts:
This sample script customizes client behavior in the following ways:
Prevents the client user from leaving a metadata field if the entry contains the word test.
Prevents the user from entering an asterisk in any metadata field.
Outputs event information to the java console, such as coordinates after a user right-mouse-drags a selection on an image.
Stops releasing the batches to predefined processors and unlocks the batches.
Note that this script also writes out a line (printIn) to the java console for each script event, for verification or debugging purposes.
function ScriptStart() { java.lang.System.out.println("ScriptStart"); } function PreBatchScan(event) { // BatchScanEvent java.lang.System.out.println("PreBatchScan"); } function BatchScanBegin(event) { // BatchScanEvent java.lang.System.out.println("BatchScanBegin"); } function BatchScanComplete(event) { // BatchScanEvent java.lang.System.out.println("BatchScanComplete"); java.lang.System.out.println(event.getBatch().getBatchName() + " finished Scanning."); } function BatchSelected(event) { // BatchSelectedEvent java.lang.System.out.println("BatchSelected: " + event.getBatch().getBatchName()); } function PreBatchDelete(event) { // BatchDeleteEvent java.lang.System.out.println("PreBatchDelete"); } function CaptureImage(event) { // ImageCaptureEvent java.lang.System.out.println("CaptureImage"); } function DocumentCreated(event) { // CaptureDocument java.lang.System.out.println("DocumentCreated"); } function DocumentSelected(event) { // DocumentSelectedEvent java.lang.System.out.println("DocumentSelected: " + event.getDocument().getTitle()); } function FieldGotFocus(event) { // FieldEvent java.lang.System.out.println("FieldGotFocus"); } function FieldLostFocus(event) { // FieldEvent var dataField; java.lang.System.out.println("FieldLostFocus"); dataField = event.getField(); if (dataField.getUncommittedText().equalsIgnoreCase("test")) { event.setCancel(true); java.lang.System.out.println("invalid value. script will not allow leaving focus."); } } function FieldProcessKey(event) { // FieldEvent var keyEvent; // java.lang.System.out.println("FieldProcessKey"); keyEvent = event.getKeyEvent(); if (keyEvent.getID() == java.awt.event.KeyEvent.KEY_TYPED) { //java.lang.System.out.println(keyEvent.getKeyChar()); if (new java.lang.Character(keyEvent.getKeyChar()).equals(new java.lang.Character('*'))) { java.lang.System.out.println("Asterisk not allowed in any field."); keyEvent.consume(); } } } function PostCaptureImage(event) { // ImageCaptureEvent java.lang.System.out.println("PostCaptureImage"); } function PreCaptureImage(event) { // ImageCaptureEvent java.lang.System.out.println("PreCaptureImage"); } function PreUploadItem(event) { // UploadItemEvent java.lang.System.out.println("PreUploadItem: " + event.getCaptureItem().getFilename()); } function PostUploadItem(event) { // UploadItemEvent java.lang.System.out.println("PostUploadItem: " + event.getCaptureItem().getFilename()); } function DBSearchComplete(searchEvent) { // DBSearchEvent java.lang.System.out.println("DBSearchComplete."); } function DBSearchResults(searchEvent) { // DBSearchEvent var results; var resultRow; var searchParameters; java.lang.System.out.println("DBSearchResult"); results = searchEvent.getRowResults(); java.lang.System.out.println("Found " + results.size() + " results."); } function DBSearchStart(searchEvent) { // DBSearchEvent java.lang.System.out.println("DBSearchStart"); java.lang.System.out.println("Metadata value being sought: " + searchEvent.getMetadataValue()); } function DocumentRemoved(event) { // DocumentRemovedEvent java.lang.System.out.println("DocumentRemoved"); } function PostDownloadItem(event) { // DownloadItemEvent java.lang.System.out.println("PostDownloadItem: " + event.getCaptureItem().getFilename()); } function PreDownloadItem(event) { // DownloadItemEvent java.lang.System.out.println("PreDownloadItem: " + event.getCaptureItem().getFilename()); } function RegionSelected(event) { // RegionSelectedEvent java.lang.System.out.println("RegionSelected"); var rect = event.getSelectionRectangle(); java.lang.System.out.println("Rectangle (X,Y): (" + rect.getX() + "," + rect.getY() + "); (W,H): (" + rect.getWidth() + "," + rect.getHeight() + ")"); } function PreReleaseBatch(event) { // ReleaseBatchEvent // Skips the postProcess setting specified in the Capture profile and only unlocks the batch. event.setProcessorID(null); event.setJobID(null); }
This sample script customizes client behavior in the following ways:
Uses the BatchScanBegin function to restrict files that can be imported to those with a .TIF extension only.
Uses the DBSearchResults function to modify the results of a database lookup so that only the first result is used, and prevents the results list from displaying.
function BatchScanBegin(event) { // BatchScanEvent // Check if there are files being imported. var sourceFilesList = event.getSourceFiles(); if (sourceFilesList != null) { // Create a list to hold the filtered results. var filteredList = new java.util.ArrayList(); // Loop through each of the files. var iterator = sourceFilesList.iterator(); while (iterator.hasNext()) { // If the file name ends with ".TIF", add it to the list. var file = iterator.next(); var filename = file.getName().toUpperCase(); if (filename.endsWith(".TIF")) { filteredList.add(file); } } // Replace the original list with the filtered list. event.setSourceFiles(filteredList); } } function DBSearchResults(searchEvent) { // DBSearchEvent var results; var resultRow; var searchParameters; // Return only the first search result. results = searchEvent.getRowResults(); if (results.size() > 0) { resultRow = results.get(0); results.clear(); results.add(resultRow); // Do not display the list of results to the user. searchEvent.setDisplayHitlist(false); } }
This sample script customizes client behavior in the following ways:
Uses the PreReleaseBatch event to copy metadata from the first document in a batch to the remaining documents in the batch. Copying of metadata takes place when the batch is released. The variable, fieldsToCopy, specifies which metadata fields are to be copied. For each document to which fields are being copied, if a field already contains a value, that value is not overwritten.
Iterates through the documents in a batch.
Obtains the metadata fields from a document.
Sets the metadata field values.
Saves the changes to a document.
function PreReleaseBatch(event) { // Metadata fields to copy to remaining documents var fieldsToCopy = new Array("Account Name", "Account Number"); // Loop through each batch being released var batches = event.getBatches(); for (var batchIdx = 0; batchIdx < batches.size(); batchIdx++) { var batch = batches.get(batchIdx); var documents = batch.getDocuments(); if (documents.size() == 0) continue; // Get the first document from which we'll be copying var firstDocument = documents.get(0); var captureFields = []; // Create an array of the first document's fields var fieldDefs = batch.getWorkspace().getFieldDefinitions(); for (var fieldIdx = 0; fieldIdx < fieldsToCopy.length; fieldIdx++) { var fieldID = fieldDefs.findByName(fieldsToCopy[fieldIdx]).getId(); captureFields[fieldIdx] = firstDocument.getFields().get(fieldID); } // Loop through the remaining documents in the batch for (var documentIdx = 1; documentIdx < documents.size(); documentIdx++) { var destDocument = documents.get(documentIdx); var fields = destDocument.getFields(); // Copy the source document's field values to the destination document for (var fieldIdx = 0; fieldIdx < captureFields.length; fieldIdx++) { var sourceField = captureFields[fieldIdx]; // If the field in the source document was never set, skip it. if (sourceField == null) continue; // Look up the field in the document var destField = fields.get(sourceField.getFieldName()); // If it doesn't exist yet, create it if (destField == null) destField = fields.add(sourceField.getFieldName()); // If the value hasn't been set yet, set it if ((destField.getValue() == null) || (destField.getValue().isEmpty())) { destField.setValue(sourceField.getValue()); destField.setDisplayValue(sourceField.getDisplayValue()); } } // Save the document. destDocument.persist(); } } }