On Barcode, MSR or RFID Scan

If you want to perform special processing on items scanned into the computer, the Scan Handler is often powerful enough to make the changes you need. The Scan Handler settings, found in the Configuration Manager, are located in Emulation Parameters > Scanner > Common > Scan Handler. However if the Scan Handler is insufficient, you can use a script to perform any processing you need.

Before you can activate the script for a scan, you must create a string variable and a number variable.

The string variable allows you to obtain the initial scan data.

The number variable allows you to obtain the type of scan data.

Refer to Symbologies and Values for the values of different symbologies. You can also use the Get_Scan_Type_Name and Get_Scan_Type_Value commands to display or handle scan types. Using the Get_Scan_Type_Value means all types are specified in the editor and you can select the type you want to use.

Calling the Scan_String command before your script exits allows Terminal Emulation to handle the scanning data. Because you are specifying the data and type returned, the script can change either one. If the script exits without calling Scan_String, the scanned data disappears.

To configure the On Barcode, MSR, or RFID Scan method:

1  Create the Scan_String and Scan_Type variables.

Once you create these variables, the On Barcode, MSR or RFID Scan option becomes available.

Create these variables in the String Variables and Number Variables tabs. For information on variables, see Creating Variables.

2  Select the General tab or Activate tab in the Script Editor.

3  Enable the On Barcode, MSR or RFID Scan option.

4  From the drop-down menu, select the Scan_String.

5  From the drop-down menu select the Scan_Type.

6  Click OK.

On Barcode, MSR or RFID Scan Example 1

The following is a sample script you can use if you want to insert a string (which could be just one character long) after the first six characters of any barcode at least six characters long.

A few notes about the sample script:

ScanData is a string variable with the original barcode.

NewString is a variable where you store the new barcode.

ScanType is the number variable that keeps the type of scan data received.

OldLength is an integer variable.

XXYY is the string you insert.

OldLength=String_Length(ScanData)
If (Number_Greater_Than_Or_Equal(OldLength,6))
NewString=String_Combine(String_Left(ScanData,6), "XXYY" )
NewString = String_Combine(NewString,String_Right(ScanData, Number_Minus(OldLength,6)))
Else
NewString = ScanData
End_If
Scan_String(NewString,ScanType)
Return

On Barcode, MSR or RFID Scan Example 2

This example converts any DataMatrix scan values to PDF417 scan values. The ScanData and ScanType variables described for the previous example are used again.

If (Number_Equal(ScanType,Get_Scan_Type_Value("DATAMATRIX")))
Scan_String(ScanData,Get_Scan_Type_Value("PDF417"))
Else
Scan_String(ScanData,ScanType)
End_If
Return

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

Privacy and Legal