Vision & Sensors
Barcode Readers

Barcode Readers Enhanced with JavaScript

Advanced Barcode readers have an embedded Javascript engine that can perform many tasks required by the user

May 1, 2014
/ Print / Reprints /
ShareMore
/ Text Size+
Trans

A computer program that is designed for data entry including invoice numbers, serial numbers, and package labels can accept data in two ways. The first is with a manual keyboard entry and the second is with a barcode reader. You can always type in data, but this is very slow and tedious, especially if you have to process hundreds or thousands of orders a day.

Barcode readers with a USB keyboard interface can do all the data entry for you. The data is still printed on the paperwork, typically directly under the barcode, in the unlikely event that the barcode reader fails. Or, so that a user can confirm visually that he has the right label without actually having to type it in. Barcode readers eliminate errors commonly associated with normal keyboard entry and speed up the order processing by a factor of 100.

Barcode readers even have the capability to add additional keys before or after the barcode data. Using a prefix can get you to the correct position on the screen. You can use a suffix such as the ENTER key to begin processing an order.

Adding a prefix or suffix character to the barcode data is not new. Over the years, it has been expanded from one or two characters to an unlimited number of characters that you can add anywhere in the output string. You can even divide the barcode data into pieces so that it can be formatted correctly in different entry locations on the screen.

TECH TIPS

Three-dimensional imaging is a different method of imaging that is more limited in some areas and more capable in others.

The 3-D imaging method does not produce gray scale or color information, although conventional imaging may be added to accomplish this.

Today 3-D imaging is generally used only when it is necessary to do things that are impossible or difficult to do with conventional imaging. 

Simple configuration tools may not be powerful enough to do all the data manipulation that you need to do for your application. More advanced barcode readers have an embedded JavaScript engine that can perform many tasks required by the user. In addition to the standard barcode data read, the software can analyze information such as the position of the barcode during the read, the orientation of the code, and what barcode type is being used. Even multiple barcodes can be read and analyzed at the same time. Based on all the additional information gathered by the barcode reader, the JavaScript code can make decisions on what to do with the data. You have to remember that the most advanced barcode readers are actually barcode imagers. They take a picture of the barcode and then decode it. Lasers have been replaced by extremely powerful LEDs and a CMOS camera.

Here are some examples of how you could program a barcode reader using JavaScript. I have predefined in the JavaScript certain keyboard keys including ENTER, F10, ALTK, and TAB. For example, if a TAB in JavaScript is used, then the output from the barcode reader would be equivalent to pressing the TAB key on the keyboard. The ALTK key is actually a dual key press where the ALT key is held down and the K key is pressed.

Define how data matrix codes are used

A Data Matrix code can be used to track the serial numbers of individual products. In this case, the user may only want to pass this data through and add a simple ENTER key at the end of the string.

 

//if data is from a Data Matrix barcode symbology

if(decode.symbology == 31)

{

//Pass the data through and add an ENTER key as suffix

decode.data = decode.data + ENTER;

return decode;

}

Define what to do when scanning a barcode with the data “F10”

A warehousing system can be set up using a scan sheet so that a user is never required to touch the keyboard. So in this case, if a type “3 of 9” linear barcode is scanned and the data in that barcode is exactly “F10”, then an F10 key is pressed.

 

//if a linear barcode symbology of type “3 of 9” is used

            if(decode.symbology == 18)

            {

//If the data in the barcode contains exactly the data “F10” then send the F10 key

            if(decode.data == “F10”)

                            {

                                            decode.data = F10;

                                            return decode;

                            }

            }

Define what to do when scanning
box-size information

A computer used to enter shipping information may be required to display the box dimensions. This data can be split into three fields defined by the length, width, and height of the box. One barcode can be scanned with a defined box size and split automatically into these three fields. This is what it looks like in JavaScript:

 

//if a linear barcode symbology of type “3 of 9” is used

if(decode.symbology == 18)

{

        //Length of the barcode must be exactly 6 characters long

        if(decode.data.length == 6)

        {

                //Send ALTK key and three TAB keys

                //Send first 2 characters

                //Send TAB key

                //Send next two characters

                //Send TAB key

                //Send final two characters

                //Send TAB key

                decode.data = ALTK + TAB + TAB + TAB + decode.data.substring(0,2) + TAB +                                        

    decode.data.substring(2,4) + TAB + decode.data.substring(4,6) + TAB;

                return decode;

        }

}

 

Scanning data from an order

The data from an order can also be passed through. If using a standard linear barcode, some extra ENTER keys can be added to the end of the string.

 

//if a linear barcode symbology of type “3 of 9”

//if the barcode is not exactly 6 characters long

if(decode.symbology == 18 && decode.data.length != 6)

{          //Send the data with two ENTER keys

            decode.data = decode.data + ENTER + ENTER;

            return decode;

}

 

 These are just a few simple examples of what a powerful JavaScript programming language can do inside a barcode reader. Because the output of the barcode reader is a USB keyboard, there is no chance for any of the upper-level manipulation of the barcode data to be done on the PC. All data processing must happen inside the reader. Think about more powerful possibilities for barcode readers. For instance, all of the barcodes can be stored in the reader and uploaded later. Multiple barcodes can be compared internally so that duplicate orders don’t get processed accidently. Now you are limited only by the information that the barcode contains and the location where you will put it. 

Did you enjoy this article? Click here to subscribe to Quality Magazine. 

You must login or register in order to post a comment.

Multimedia

Videos

Podcasts

 In honor of World Quality Month, we spoke to James Rooney, ASQ Past Chairman of the Board of Directors 2013, for his take on quality around the world.
For more information, read the ASQ Speaking of Quality column.
More Podcasts

Quality Magazine

CoverImage

2014 August

Check out the August 2014 edition of Quality Magazine for features!

Table Of Contents Subscribe

The Biggest Obstacle/Concern?

In the current economic and business climate, what is the biggest obstacle/concern to your job?
View Results Poll Archive

Clear Seas Research

qcast_ClearSeas_logo.gifWith access to over one million professionals and more than 60 industry-specific publications,Clear Seas Research offers relevant insights from those who know your industry best. Let us customize a market research solution that exceeds your marketing goals.

eNewsletters

STAY CONNECTED

facebook_40.png twitter_40px.png  youtube_40px.pnglinkedin_40px.png