Quality Magazine logo
search
cart
facebook twitter linkedin youtube
  • Sign In
  • Create Account
  • Sign Out
  • My Account
Quality Magazine logo
  • NEWS
  • PRODUCTS
    • FEATURED PRODUCTS
    • SUBMIT YOUR PRODUCT
  • CHANNELS
    • AUTOMATION
    • MANAGEMENT
    • MEASUREMENT
    • NDT
    • QUALITY 101
    • SOFTWARE
    • TEST & INSPECTION
    • VISION & SENSORS
  • MARKETS
    • AEROSPACE
    • AUTOMOTIVE
    • ENERGY
    • GREEN MANUFACTURING
    • MEDICAL
  • MEDIA
    • A WORD ON QUALITY PUZZLE
    • EBOOK
    • PODCASTS
    • VIDEOS
    • WEBINARS
  • EVENTS
    • EVENT CALENDAR
    • IMTS
  • DIRECTORIES
    • BUYERS GUIDE >
      • Supplier Insights
    • NDT SOURCEBOOK
    • VISION & SENSORS
    • TAKE A TOUR
  • INFOCENTERS
    • Digital Quality Management Systems
    • NEXT GENERATION SPC & QUALITY ANALYTICS
  • AWARDS
    • ROOKIE OF THE YEAR
    • PLANT OF THE YEAR
    • PROFESSIONAL OF THE YEAR
  • MORE
    • Expert Columns
    • NEWSLETTERS
    • QUALITY STORE
    • INDUSTRY LINKS
    • SPONSOR INSIGHTS
  • EMAG
    • eMAGAZINE
    • ARCHIVES
    • CONTACT
    • ADVERTISE
  • SIGN UP!
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

By Tim Cicerchi
May 1, 2014

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. 

KEYWORDS: barcode readers

Share This Story

Looking for a reprint of this article?
From high-res PDFs to custom plaques, order your copy today!

Tim Cicerchi is a product manager for Pepperl+Fuchs in Twinsburg, OH. For more information, visit www.pepperl-fuchs.us or email [email protected]

Recommended Content

JOIN TODAY
to unlock your recommendations.

Already have an account? Sign In

  • 2024 Quality Rookie of the Year Justin Wise 1440x750px banner with "Quality Rookie of the Year" logo inset

    Meet the 2024 Quality Rookie of the Year: Justin Wise

    Justin Wise is an exceptional individual who has been...
    Aerospace
    By: Michelle Bangert
  • Man with umbrella and coat stands outside while it rains at night looking at a building.

    Nondestructive Testing: Is there an ethics problem?

    I was a whistleblower who exposed fraudulent activities...
    NDT
    By: Dale Norwood
  • Unraveling Deflategate: Football stadium with closeup of football on field

    Unraveling the Tom Brady Deflategate

    The Deflategate scandal erupted following the 2014 AFC...
    Measurement
    By: Greg Cenker and Henry Zumbrun
Manage My Account
  • eMagazine Subscriptions
  • Newsletters
  • Online Registration
  • Subscription Customer Service
  • Manage My Preferences

More Videos

Sponsored Content

Sponsored Content is a special paid section where industry companies provide high quality, objective, non-commercial content around topics of interest to the Quality audience. All Sponsored Content is supplied by the advertising company and any opinions expressed in this article are those of the author and not necessarily reflect the views of Quality or its parent company, BNP Media. Interested in participating in our Sponsored Content section? Contact your local rep!

close
  • This image shows a person seated next to a Bobcat T66 compact track loader.
    Sponsored byPolyWorks by InnovMetric

    Supercharging Digital Gauging at Bobcat North America

  • Dorsey Calibration Lab photo by Tom LaBarbera Picture this Studios
    Sponsored byDorsey Metrology International

    Ensuring Product Quality in a Competitive Manufacturing Landscape

  • This image displays a Eddyfi Technologies Cypher portable inspection instrument alongside a scanner for non-destructive testing (NDT).
    Sponsored byEddyfi Technologies

    A Safer, Smarter Approach to Weld Inspection: Why Advanced Ultrasonic Testing Is Redefining Industry Standards

Popular Stories

a titanium diaphragm speaker driver

The One Thing Elon Gets Right Is Designed to Scare You

This image shows a person seated next to a Bobcat T66 compact track loader.

Supercharging Digital Gauging at Bobcat North America

Dorsey Calibration Lab photo by Tom LaBarbera Picture this Studios

Ensuring Product Quality in a Competitive Manufacturing Landscape

2026 Quality Professional of the Year!

Events

June 9, 2026

Future-Proof your Quality Processes with Advanced 3D Optical CMM Technology

Discover how to effortlessly capture complex data, leverage true multi-sensor automation, and ensure continuous operation without creating inspection delays.

June 22, 2026

Automate 2026

Automate is North America's largest robotics and automation event — and the best place to take your ideas from insight to impact.
 
Our show floor features the world’s leading automation solutions, from AI and robotics to motion control, vision systems, and more. Plus, our educational conference is second to none, led by the brightest minds in automation today.
 
Ready to transform the way you work? Take the next step at Automate.
View All Submit An Event

Products

Lean Manufacturing and Service Fundamentals, Applications, and Case Studies

Lean Manufacturing and Service Fundamentals, Applications, and Case Studies

See More Products
Quality Podcast Channel Custom Content

Related Articles

  • Barcode Readers

    See More
  • Lucid White Paper

    Time of Flight Gets Precise: Enhanced 3D Measurement With Sony® DepthSense® Technology

    See More
  • DISCUS-10 on desktop

    PCC Airframe Achieves Enhanced Efficiency and Consistency with Discus Software’s IDA

    See More

Related Products

See More Products
  • Green Lean: Achieving Outstanding Environmental Performance with Lean DVD

  • leanss.jpg

    Lean Six Sigma for Engineers and Managers With Applied Case Studies

See More Products

Related Directories

  • HD Barcode

    We offer the most advanced 2D Code in the world, HD Barcode for: Positive Identification and Biometrics, Anti-Counterfeiting and Diversion, Track and Trace, Food Safety, and the Identification & Training of Personnel. Vision Inspection for automated proofreading of incoming materials.
  • Complete Inspection Systems Inc. / HD Barcode LLC

    HD Barcode, LLC provides a full range of brand protection, anti-counterfeiting, and identification solutions for training and emergencies utilizing our patented, secure 2D code. Unlike a QR Code, HD Barcode can embed over 225 times the amount of data including color photos and text in any language. CIS provides automated vision inspection for incoming materials, proofreading, and end of line verification.
×

Stay in the know with Quality’s comprehensive coverage of
the manufacturing and metrology industries.

Newsletters | Website | eMagazine

JOIN TODAY!
  • RESOURCES
    • Advertise
    • Contact Us
    • Directories
    • Manufacturing Division
    • Store
    • Want More
  • SIGN UP TODAY
    • Create Account
    • eMagazine
    • Newsletters
    • Customer Service
    • Manage Preferences
  • SERVICES
    • Marketing Services
    • Market Research
    • Reprints
    • List Rental
    • Survey/Respondent Access
  • STAY CONNECTED
    • LinkedIn
    • Facebook
    • YouTube
    • X (Twitter)
  • PRIVACY
    • PRIVACY POLICY
    • TERMS & CONDITIONS
    • DO NOT SELL MY PERSONAL INFORMATION
    • PRIVACY REQUEST
    • ACCESSIBILITY

Copyright ©2026. All Rights Reserved BNP Media, Inc. and BNP Media II, LLC.

Design, CMS, Hosting & Web Development :: ePublishing