1 2 Previous Next 20 Replies Latest reply on Jul 22, 2014 3:09 PM by philmodjunk

    barcode scanner



      barcode scanner



           I would like to write a script so that when I scan a barcode label, the record attached to that label is pulled up in the database.


        • 1. Re: barcode scanner

               And what hardware will you be using?

               Will you be using a USB barcode scanner? In "keyboard emulation mode" (the default setting for most of these units)?

               Or will you be using the camera on an iOS device to scan the barcode?

               Both are possible, but the implementation details differ.

          • 2. Re: barcode scanner

                 Yes, I will be using a usb barcode scanner in "keyboard emulation mode"

            • 3. Re: barcode scanner

                   See this thread: Need help writing script to integrate barcode scanning for examples of how you might set this up.

              • 4. Re: barcode scanner

                     Sure, I have read that already actually and am having some problems understanding it.


                     If there is an *before and after the barcode # (*123245*) is that equivalant to the special command you mentioned?

                     Currently when I scan labels, that label # scanned is being entered into what ever field my cursur is in the FM database.

                • 5. Re: barcode scanner

                       That is not what that thread describes. You may need to consult with the technical support staff for your scanner if you cannot find out how to do this with your scanner in the accompanying documentation, but most scanners can be "programmed" to append text to the beginning and/or end of the scanned text. Some scanners come with software for configuring the scanner. One that I used could be "programmed" by scanning special barcodes in the user manual--the exact details and key combinations possible will differ with the scanner.

                       So once you have configured your scanner to do it, if you scan a barcode for 123, the scanner actually enters something like ~123¶ were ¶ is the return character.

                       Then OnLayoutKeystroke can check for the ~ and put the cursor into the correct field and if you then set up that field so that a return key exits the field, you can use the OnObjectExit trigger to detect the fact that the image has been fully scanned into the field and then performs the needed script to find the record with the code 123.

                       Please note that if you ever find that you can't use the scanner--it's down or the label is damaged and won't scan, you can manually enter the barcode into this same field and press return to get the same result. (Ever see a cashier do that at a cash register?)

                  • 6. Re: barcode scanner



                         I just received a bar code from the scanner company to program the scanner and the prefix and suffix are the same character "~". Is that a problem? Do the preamble and post-amble characters need to be different, (i.e. "~" and "¶")?

                    • 7. Re: barcode scanner

                           The example scripts in that thread require different preamble and postamble characters. The first one is detected in the script run by OnLayoutKeystroke and puts the cursor into the field so that the characters can be entered correctly. The Return at the end trips the OnObjectExit trigger set on this field to perform the script that then uses this data to do what you want done with it. Using this method, the Postamble can be a return, enter or tab character so long as you set up the field's behavior on the Inspector's data tab such that this character is one of the listed characters for moving the focus to the next field--which is what triggers the OnObjectExit script trigger.

                           This is not your only option for getting the second script to be perfomed.

                           I've also gotten this to work using InstallOnTimer Script.

                           How that works:

                           The first script detects the Preamble character(s) and puts the focus into the correct field using go to field or go to object. Then it performs an Install OnTimer Script with a very short interval. 1 second will probably work, but you'd have to test this and increase the interval slightly if needed to make sure that the interval is longer than the time needed to scan the barcode into the field.

                           Then your script to process the scanned data is the script step by this "timer" to be performed when the interval elapses. A final script step in your script uses Install OnTimer Script with no specified interval to cancel the timer. This is important or your script will process the data in the field over and over again on 1 second intervals.

                      • 8. Re: barcode scanner

                             If it isn't too much trouble could you write (copy ) the script here for the second option you mentioned, the on the timer options???  Also, would I be applying this script to the specific barcode field (text field that holds the barcode/barcode script) ??


                             THANK YOU!!!!

                        • 9. Re: barcode scanner

                               They're nearly the same scripts:

                               If [Get ( TriggerKeyStroke ) = "~" and Get (TriggerModifierKeys) = 3 ]
                                  Go to Field [YourTable::FieldForScannedData]
                                  Install OnTimerScript ["ProcessScanScriptNameHere" ; interval: 1 ]
                                  Exit Script [False]
                               End IF

                          Install OnTimerScript[]
                               Go To layout [specify the layout where you need this to happen if not the layout where you have your scanned field]
                               Enter Find mode [] ---> clear the pause check box
                               Set Field [YourTable::DataField ; YourTable::ScannedData ] ---> ScannedData must have global storage speciifed or this script won't work
                               Set Error Capture [on]
                               Perform FInd []
                               If [ Not Get ( FoundCount ) // error: no records found]
                                  Show Custom Dialog ["No record was found"]
                                 #put the rest of your script here
                               End If

                          • 10. Re: barcode scanner


                                 I can't get it to work. Here are what my two scripts look like and I am setting the Script Trigger to the Bar Code Field(field that looks like a typical barcode) OnObjectKeyStroke and it is enabled in Browse and Find mode :

                                 -IF[Get (TriggerKeystroke) = " * " and Get (TriggerModiferKeys) = 3]

                                 -Go to Field [Sale Table::Bar Code]

                                 -Install on Timer Script ["ProcessScanScriptName"; Interval: 1]

                                 -Exit Script []

                                 -End IF


                            -Go to Layout ["RAM Sales Layout"]

                                 -Enter Fine Mode []

                                 -Set Field [Sale Table::Serial Number[Sale Table::Bar Code]]

                                 -Set Error Capture [On]

                                 -Perform Find []

                                 -IF [no Get (FoundCount) // error: no records found]

                                   -Show Custom Dialog ["no record found"]


                                 -End IF


                            • 11. Re: barcode scanner

                                   Get ( TriggerKeystroke ) only returns a single character.


                                   Get ( TriggerKeystroke ) = " * "

                                   will never be true as the single character returned by the function will never equal the three characters ( a space, an asterisk and another space) shown in quotes.

                              • 12. Re: barcode scanner

                                     Should I erase the: ( TriggerKeystroke ) = " * "  ??

                                     Can you tell from what I have posted, why it my not be working??

                                • 13. Re: barcode scanner

                                       I just posted why it is not working

                                       The three characters of " * " will never equal any possible value returned by Get ( TriggerKeystroke ) as this function only returns a single character.

                                       It is not clear to me what Preamble you have configured your scanner to put in front of the text read by the scanning head. Thus, I cannot, from the information available to me, tell you exactly what change you need to make in order to get this to work.

                                       One barcode format precedes and ends all barcodes with an asterisk, but this would not be a "pre-amble" set up by configuring the scanner, it's just the first letter of the barcode in those cases. (And I'd test this with a plain text field or on a word processor page to see if with that barcode format, the asterisk is actually input as the first character.)

                                  • 14. Re: barcode scanner


                                    It didn't copy the lines but this is what is underneath the BarCode field.

                                    I believe the * are both pre/post amble for the scanner.

                                    If I'm understanding you correctly, an * can NOT be set as the pre/post amble figures for the scanner? OR it could be but the only way to tell is do the following you stated...."(And I'd test this with a plain text field or on a word processor page to see if with that barcode format, the asterisk is actually input as the first character.)"

                                    1 2 Previous Next