8 Replies Latest reply on Sep 8, 2014 7:28 PM by MindyLynn

    Reading with a Barcode Scanner

    rjlevesque

      Title

      Reading with a Barcode Scanner

      Post

      I need a field to be waiting to read whatever is scanned in with a barcode scanner. What is the most efficient way to accomplish this? I have several script steps which add to the time it takes for a response, so I want to be able to accept the scan in the most efficient way I can. (array? loop?)

      Any suggestions are appreciated =)

      RJ

        • 1. Re: Reading with a Barcode Scanner
          philmodjunk

          Any scanner I've worked with comes with the ability to configure it so you can have text added to the beginning of the stream of scanned text.

          You can then use an On Keystroke script trigger specified for the layout to perform a script that checks for the key or key combination that you've set as the "pre-amble" to your stream of scanned text. If it detects this text, use go to field or go to object to place the cursor in the field so that the rest of the scanned text is entered into the field.  I use a single key pre-amble with one or more modifier keys and then use Exit Script [false] to keep this text from being entered into a field in the database.

          You'll need to consult the technical info that comes with the scanner to figure out how to program it to include such text.

          • 2. Re: Reading with a Barcode Scanner
            rjlevesque

            It is a basic symbol scanner with keyboard emulation, so right now I have it reading the first 4 characters of the scanned entry to determine what layout, field, and script to go to next. However, using that On Keystroke trigger fires the next step after the first character and a timer just isn't the trick.

            • 3. Re: Reading with a Barcode Scanner
              philmodjunk

              Any scanner I've worked with uses keyboard emulation and can be configured to add text to the beginning and end of the scanned text. That's something of an industry standard approach so software can be synched with the scanner. Have you checked the technical info and/or tech support for this scanner to see if that's possible?

              We use this general script outline with one of our scanners:

              If [ Get ( TriggerKeystroke ) = "~"  and
                    Get ( TriggerModifierKeys ) = 3 /* Modifier 3 means shift and capslock are down */ ]

                  Go To Field [YourTable::YourTextField]
                  Exit Script [ Result: False ]

              End If

              Note that this script trigger ignores all keystrokes except a specific key and then only if both caps lock and shift are also depressed. It's sole job is to put the cursor in a text field so that the rest of the scanned text can be captured in that text field. We then use an On ObjectExit trigger to process the scanned text. This is where I'd be doing things like using the first 4 characters to identify what layout to switch to. I could also have used Install On Timer in this script as a way to trigger the follow on script to process the scanned data.

              • 4. Re: Reading with a Barcode Scanner
                rjlevesque

                Ok but I need it to loop, I need the cursor to sit in the box and read a 4 character entry when it is scanned in. Then depending on which 4 character entry is scanned in it chooses what to do next. So FCN1 is scanned in then perform script script1here, if FCN2 perform script2here. otherwise just keep sitting in that field and see what the scanner enters.

                • 5. Re: Reading with a Barcode Scanner
                  philmodjunk

                  Why would that require a loop?

                  Keep in mind that there's a follow on script performed by either a  script trigger or timer to process the scanned data. Each time you scan something, it starts the process all over again.

                  • 6. Re: Reading with a Barcode Scanner
                    rjlevesque

                    True, good point...

                    • 7. Re: Reading with a Barcode Scanner
                      rjlevesque

                      Ok, works great in my sample solution, then soon as I integrate it into my main solution it doesn't work. LOL

                      CORRECTION:

                      Ok, stupid mistake on my part, all working now. Thanks a bunch Phil!  =)

                      • 8. Re: Reading with a Barcode Scanner
                        MindyLynn

                        In my project, i also need to decode Code 128 barcode, is there any barcode scanner app that doesn't use keyboard emulation?