6 Replies Latest reply on Aug 24, 2012 2:13 AM by thermograph

    Script question, help please

    thermograph

      Hello,

       

      I'am a complete newbie in Scripting for FMPro 12.

      Could someone help me start in the good direction...

       

      • When opening the database, the cursor must stay per default in the field "Barcode"
      • When the numerical string (from a barcode reader) arrives, a search must be launched for searching the corresponding barcode in the field "ISBN"
      • When this is found, the whole article must be displayed on the screen.
      • Then the field "barcode" must be left blank.

       

      As an example I was using FM GO! with "Quick Find" or "Enter Find Mode" as a manual methode...

       

      How to start with that, is a script the right way...

       

      Thanks for your help!

        • 1. Re: Script question, help please
          thomas_staehli

          Hi,

           

          This is a pretty easy task in FM using script triggers. There are different ways to do this, but I guess I would do it like this:

           

          1) Create a global field "BarcodeSearch"

           

          2) Set up "OnLayoutEnter" (in the layout script triggers) to launch a simple script that would do "go to Field (BarcodeSearch)". If you want the cursor to stay inside at all time (even when clicking outside), you can use another trigger "OnObjectExit" that would lauch the same script that goes back to the field.

           

          3) Set up OnObjectModify to launch a script that would search for that barcode in the ISBN field and empty the BarcodeSearch field. Make sure that you add a condition in your search script to "exit script" at the beginning if the BarcodeSearch field is blank.

           

          I'm not sure 100% that this would work as I don't have a Barcode scanner, but this is definitely what I would try first.

           

          I hope this will help.

          • 2. Re: Script question, help please
            thermograph

            Thanks Thomas,

             

            I'll give it a try...

             

            Best regards,

            Marc

            • 3. Re: Script question, help please
              thermograph

              Hi Thomas,

               

              I have no "OnObjectModify" in my scripttriggers.

              Can it have an other name?

               

              Thanks,

              Marc

              • 4. Re: Script question, help please
                ariley

                Hi Thermograph,

                 

                It is much easier to use a custom dialog for scanning. The dialog could pop up when you open the DB and wait for scan. Then you script the procedure from there to create a recoord and do whatever else needs to be done.

                 

                At ZeroBlue we are here to help with Barcoding. We also sell barcode scanners, RFID readers and now mag swipe readers to swipe credit cards.

                 

                We can also implement Barcoding in your solution if needed.

                 

                Best regards,

                 

                agnes b. riley . filemaker and web development

                www.zerobluetech.com

                T 201-299-6223 (NJ) . 212-842-8830 (NY) . 917-660-7221 (C)

                FileMaker Certified in 10 and 11

                • 5. Re: Script question, help please
                  jmrusch

                  There definitely is an OnObjectModify script trigger -- I've used it!

                   

                  However, I've done the same basic thing you're trying to do with barcode scanners and I generally start the way Thomas suggests, with a global field on a pop up layout. There's a script trigger on the global field, which I usually set up as OnObjectExit.

                   

                  The barcode scanner is programmed so that it sends data like this:

                   

                  1. A Control+1 (or Command+1) on Mac. This runs the script that is in the first position on the Script menu. All it does is open a new window, go to the layout with the global field and put the cursor in the global field. This script first checks to see if there is a "Waiting for Barcode" window already open, and if so, selects that window and puts the cursor in the global field.

                   

                  2. I generally program a string of nonsense characters, like "~~~~~" to slow things down a bit. If I don't do this, the first part of the real data is sometimes lost.

                   

                  3. The actual data comes next.

                   

                  4. Finally, program a tab or return key, either of which will trigger the global field's OnObjectExit script.

                   

                  That script is the key to what happens next. It reads the contents of the global field and filters out everything except the characters I might expect (for ISBNs, that is probably just numbers 0-9, but I suppose could also include dashes) and stores the result in a variable. Once that is done, the global field is cleared. Then the script does whatever needs to happen next, which in your case would be using the variable in a find and displaying of found data.

                   

                  HTH,

                  Julie

                  • 6. Re: Script question, help please
                    thermograph

                    Thanks folks,

                     

                    for the helpfull answers.

                     

                    Marc