BarcodeScanner

Sepasoft MES Module Suite

Barcode Scanner | Vision

An invisible component that listens for barcode input received via a keyboard interface. The term invisible component means that this component appears during design time, but is not visible during runtime.   

There are over 100 barcode patterns predefined to support the most common and GS1 international standards. All the patterns are customizable and can be enabled as required. Multiple components can be used on the same window to detect different types of barcodes.

The component listens to keystrokes based on a defined preamble and an optional post amble specification, then decodes the raw barcode using regular expression patterns and passes the results to a script event. The component is designed to work in the background and allow scripting to process the results of the barcode content, such as auto fill fields or update information.  

Information

This component when enabled will listen for barcode input only on Stage or Published clients. It doesn't activate in the designer's preview mode.

Barcode Detection and Decoding

 

Component Palette


Features

The Barcode Pattern Configuration property allows custom menu items to be added.

Click the  icon of  the property to open barcode dataset viewer and add your custom menu items. These menu options become available in the client through scripting, please see the event handlers section of this page for examples. 

Custom script can then be added to the onBarcodeReceived event handler to add functionality to this component.


 Component Properties

Properties are provided that can be set to affect the operation and look of the component. They can be set through the Property Editor in the Designer or through scripting.

Example

Python
event.source.parent.getComponent('Barcode Scanner').readTimeout = 1000

Barcode

NameScriptingProperty TypeDescription
Barcode Pattern ConfigurationpatternConfigurationDatasetThe set of Regex barcode patterns to search for a match.
Decode MethoddecodeMethodintDetermines if the decoding of the barcode does a single-pass or consume search method for matching patterns.
PreamblepreambleStringA character, string, or regex unicode value representing the preamble pattern (ie. \\u0002 for STX - Start of Text Ascii or GS1 Symbology Identifier ]E0, ]I1, ]C1, ]d2).
PostamblepostambleStringA character, string, or regex unicode value representing the postamble pattern (ie. \\u0003 for ETX - End of Text Ascii or \\u000D carriage return, \\u000A line feed ).
SeparatorseparatorStringA character, string, or regex unicode value representing the barcode group separator pattern (ie. \\u001D or \\u00E8 for Group Separator Ascii - GS1 Standard).
Read TimeoutreadTimeoutintThe pause timeout between keystrokes to check for a barcode scan (1000 = 1 second, range: 100-1000).

Event Handlers

Event handlers provide the ability to add custom script when a user interacts with a component.

barcode

onBarcodeReceived

Is fired after the component decodes a raw barcode. It is passed a BarcodeEvent object that contains the results of the decoding, any error message, and the raw barcode.

PropertyDescription
.sourceThe component that fired this event.
.resultsDecoded barcode results that matched the patterns given.

Example 1

Code
Sample #1 onBarcodeReceived event script:
 
#Sample Use of the Python Dictionary method to get barcode values from a single-pass #decode method
results = event.toDict()                # converts Java hashtable to Python dictionary
#Sample method to print out all result values
for key, value in results.items():
    print(key, value)
 
#Look for an error message and display it to text box
if event.hasErrorMessage():
 event.source.parent.getComponent('txtError').text = event.getErrorMessage()        
 system.util.beep()        
else:
 #Update screen components from decode results
 if 'GTIN-12' in results:
         event.source.parent.getComponent('txtUPC').text = results['GTIN-12'][0]
 if 'GTIN-13' in results:
         event.source.parent.getComponent('txtUPC').text = results['GTIN-13'][0]
 if 'GTIN-14' in results:
         event.source.parent.getComponent('txtUPC').text = results['GTIN-14'][0]
 

Example 2

Code
Sample #2 onBarcodeReceived event script:
 
# get results using Java Hashtable
results = event.getResults()
 
if event.hasErrorMessage():
 event.source.parent.getComponent('txtError').text = event.getErrorMessage()
 system.util.beep()        
 
if results.containsKey('GS1-01'):
 event.source.parent.getComponent('txtGTIN').text = results.get('GS1-01').get(1)
if results.containsKey('GS1-10'):
 event.source.parent.getComponent('txtBatchLot').text = results.get('GS1-10').get(1)
if results.containsKey('GS1-17'):
 event.source.parent.getComponent('calUseBy').date = event.GS1ConvertToDate(results.get('GS1-17').get(1))        
if results.containsKey('GS1-310'):
 event.source.parent.getComponent('numNetWeight').floatValue = event.GS1ConvertToFloat(results.get('GS1-310').get(2), results.get('GS1-310').get(1))        
if results.containsKey('GS1-390'):
 event.source.parent.getComponent('numAmount').doubleValue = event.GS1ConvertToDouble(results.get('GS1-390').get(2), results.get('GS1-390').get(1))
if event.hasUnmatched:
 event.source.parent.getComponent('txtOutput').text = event.getUnmatched()


 Extension Functions

This component does not have extension functions associated with it. 


Custom Methods

Custom methods allow you to add your own component functions to a component that can be called through scripting. This is a useful and clean method of re-using script that is specific to the component (say you want to update a visual aspect of the component in the same way whether a user clicks on the component or a window property value changes). See Component Custom Methods in the Ignition Help Manual for more information.


 Customizers

This component does not have any custom properties.


 Component Functions

This component does not have functions associated with it.

Sepasoft MES Module Suite