GetBarcode

Recognizes arbitrary 1D or 2D codes.

Syntax

bool GetBarcode()

Parameters

None

Returns

True if the action is called at the page level or field level. Otherwise, False.

In addition the calling object's value and variable "GetBarCode" will be filled with the bar code value. This action also stores barcode information such as confidence, coordinates, code name, and size. If the object's barcode settings are set to read more than one barcode, and if more than one barcode is found, then the barcodes are also stored in the variable "GetBarCodeX" where "X" is the index of the barcode found.

Level

Page and field level.

Details

Use this action to read the first barcode found on a page if the page has 1D or 2D barcodes. If recognizing on a field object, the field must have a Position assigned that corresponds to the area on the image containing the barcode when barcode reading is performed. For example, to load zone coordinates after a fingerprint has been assigned to the page, the application would invoke the CreateFields action, which creates the fields in the DCO. Then the application would call the ReadZones action to load the position coordinates from the fingerprint template associated with the page. When this is complete, the field is ready for field level barcode reading and the GetBarcode action can be called on the fields where a barcode is expected. If anchors or fingerprint matching are used, ReadZones or other registration may be required to align the fields correctly to the fingerprint template zones.

When the barcode is read, the following variables are created on the current DCO object:

GetBarCode: The recognized value of the barcode.

CodeName: The barcode type.

Confidence: The barcode confidence.

Height: The height of the barcode in pixels.

Width: The width of the barcode in pixels.

Left: The left coordinate of the barcode in pixels.

Top: The top coordinate of the barcode in pixels.

Position: Four separated values which are the coordinates of the barcode in pixels: left, top, right, bottom.

If called on a field object, the barcode value is also stored in the field's text property.

rrSet("1", "@X.bp_minExpected")
rrSet("2048", "@X.bp_tp")
GetBarcode()
This example configures the reader to expect 1 Code-128 barcode on the page and sets the barcode type in rules prior to calling the barcode action.
rrSet("1", "@X.bp_minExpected")
rrSet("1","@X.bp_enhance")
rrSet("0","@X.bp_zoom")
rrSet("1","@X.bp_binarize")
GetBarcode()

This example assumes the barcode type has previously been configured in Datacap Studio in the Bar/P tab of the Zones tab to configure the bp_tp on all objects of the current type. It also enables the binarize image enhancement to run. The minimum number of barcodes expected is 1. If 1 barcode is read, then the barcode action stops successfully. If 0 barcodes are read, the action enables the "binarize" image enhancement and tries to read the barcode again. This image enhancement is only in effect for the length of the action and does not change the source image within the batch.