Velocity: adding a Hex valued scan terminator

Version 2

    This article will go over the creation of a script in Velocity to add a custom hex value to the end of your scanned data..

     

     

    The Script:

    function onScan(event)

    {

        event.data = event.data.concat(String.fromCharCode(parseInt(hexTerm, 16)) );

    }

     

    WLEvent.on("Scan", onScan);

     

    Parameter:

     

    1. function onScan(event)

         creates a function to process the scan

    2. event.data

         This is the scanned data that is coming in

    3, event.data.concat

         This is telling the script that we are going to add to the end of the barcode

    4. String.fromCharcode

         This call returns the string created from Unicode character values

    5. parseInt with 16

         This converts the string value to a hexadecimal format

    6. WLEvent.on("Scan", onScan);

         Register the onScan function to be called when a scan occurs. Without this it will never run.