10 Replies Latest reply on Feb 3, 2011 3:39 PM by RestaurantCharlie

    Swipe Magnetic Card "Behind the Scenes"



      Swipe Magnetic Card "Behind the Scenes"


      I sent this message to PhilModJunk and he kindly replied and suggested I post it in the forum.


      My Message:

      I'm creating a solution that will do time tracking and a Restaurant POS.  Employees will be using Swipe Cards.

      My question:

      How can I input the data read off the swipe cards into a field without  the field having to be selected or even visible. You know how at all  restaurants waiters just walk up to the POS and swipe their card without  having to select anything, nor is a field visibly selected.


      PhilModJunk kindly answered:

      In fact, if you search under Magnetic Strip Reader or Bar code scanner,  you'll find several discussions of this.

      We scan California Drivers Licenses here at work, so I can speak from  experience on the subject. The key detail is that the scanners will  input data into the computer just as though you'd typed the information  in by hand so you just have to get the cursor into a field (which can be  a tiny 1 pixel by 1 pixel field to hide it.) before the swiped data is  entered and this can usually be done by programming the scanner to  precede the scan with a special character that you can detect with an  OnKeystroke trigger in FileMaker.



      Further thoughts on the subject:

      I have a MSR that can be programmed with prefix and a suffix, both for the package and the individual tracks.

      You have to type in what you want as prefix or suffix in a code, I'm not sure what it is... It includes an ASCII Table, but it only includes things like hearts, music notes, etc... I tried to type an enter or hard return as the suffix. This, in my mind, would commit the field and then a script trigger could take the action from that point... However I was unable to find the code for that, and could only find the return code <CR>. But this doesn't exit the field. So what I wound up doing is adding something random: "%LOLA%" as a suffix and running a script via the onobjectmodify script trigger that checks right( FIELD; 6)="%LOLA%". If that is true, it searches for the user. If it is not true, it selects the field again. However, it would be great to either find the code for a hard return to commit the record, or for tab to exit the object...

      Any suggestions on what character to add as the prefix to trigger the onlayoutkeystroke?

      I'm attaching an image file with a screenshot of the MSR software with a soft return as the Suffix and the ASCII Table open.

      Best wishes to all...


        • 1. Re: Swipe Magnetic Card "Behind the Scenes"

          That screen shot makes me glad we don't use that particular scanner.

          Can you enter the ASCII code for the character? If so 10 is the code for enter (numeric key pad) and 13 is the code for Return (regular keyboard).

          Either can be used to exit the field depending on the behavior settings you specify in FileMaker for this field.

          • 2. Re: Swipe Magnetic Card "Behind the Scenes"

            I tried to input 10 and 13. It takes them literally. So if the card has ABC on it, it just does ABC10.

            If I follow the format from the table <0xPUTCODEHERE> and put 10 or 13, it does nothing...

            If I type inside the field from the  MSR software, it inputs the data literally... with one exception. If I hit return(soft) or Enter (hard), it inputs <CR>. and that does actually work. In excel, it exits the cell. In Filemaker, it doesn't exit the field, it just goes to the next line. How can I set Filemaker to exit the field so I don't have to run the onobjectmodify script trigger to check for my "%LOLA%" Suffix which runs dozens of times, when scanning a CA drivers license for example.

            I guess thats what I get for looking for a bargain. The scanner was 39.99. Bought from http://www.geeks.com/details.asp?invtid=MSR250HK-PB&cpc=SCH

            It didn't come with software or anything. I had to look the model number up and find a page with the software download and a "user manual", however the user manual isn't really helpfull at all....

            • 3. Re: Swipe Magnetic Card "Behind the Scenes"

              In FileMaker, enter layout mode and select your field that is set to accept the scanned data. Use Behavior on the Data tab of the inspector to enable "go to next object using [x] return".

              Now a swipe of your card should enter the swiped data and then exit the field.

              You can also use a Install OnTimer step to trigger a script to process the scanned data 1 second after the card is swiped. With some scanners, that works better than the Return character as some scanners won't append the suffix text if the stripe is damaged.

              • 4. Re: Swipe Magnetic Card "Behind the Scenes"

                It's the little things in life...

                Ok. So I have been successful with:

                1) OnLayoutKeystroke set selection field to input card data.

                2)exiting the field on return behavior/ onobjectexit combination.

                However one thing is bothering me. I did set the field to which data is entered to 1pixel. But when the card is being read, filemaker "draws" a white line downwards from where the field is, because the info doesn't fit inside... that looks very bad, and doesn't really fel like "behind the scenes". Any ideas?

                • 5. Re: Swipe Magnetic Card "Behind the Scenes"

                  Hmmm, don't see that on my system.

                  Might be a difference in platforms. In my case the initial script is Triggered by the OnKeystroke Layout Script trigger and looks like this:

                  #Prefix text is shift, capslock ~
                  If [Get ( TriggerKeystroke ) = "~"  and
                   Get ( TriggerModifierKeys ) = 3 /* Modifier 3 means shift and capslock are down */]
                   Go To Object [Object Name: "Scan Box"]
                   Exit Script [false]
                  End If

                  I use go to Object as I have two copies of this field on the layout (One place far to the right for QA purposes) and need to put the cursor only in the tiny version of this field hidden in the upper left corner of the layout body.

                  Can't see any script steps that would affect this differently for you though.

                  • 6. Re: Swipe Magnetic Card "Behind the Scenes"

                    Hmmmm.... weird.
                    This is how my script looks:

                    Ser Error Capture[On]
                    Allow User Abort [off]
                    Freeze Window
                    If[Get (triggerkeystorke)="*"] /* I used an asterisk because I can't work modifier keys into my MSR software */
                    Go to Object [Object Name: "input"]
                    End If

                    I'm on Mac, but have also tested it on Windows with the same result. On Mac running FMP Adv 11, FMP 11 on Windows.

                    The only thing I can think of that is causing this is that each time a character is inserted into my input field, the OnKeystroke Layout Script trigger is firing and thus refreshing the window. And I can't think of a way to have the whole data on the card being inserted to the field without it exiting the script, thus being frozen the whole time.

                    • 7. Re: Swipe Magnetic Card "Behind the Scenes"

                      See what happens if you include Exit Script [False] just before End If.

                      That option is there to keep the triggering text from actually being entered into the field, but it may also affect how the screen refreshes here.

                      • 8. Re: Swipe Magnetic Card "Behind the Scenes"

                        Tried on both platforms. No luck.................Cry

                        any ideas?

                        • 9. Re: Swipe Magnetic Card "Behind the Scenes"

                          I just selected that field and checked some more settings.

                          Do not apply visual spell checking and Select entire contents on entry are both enabled. I don't see how that would affect this. System runs as FileMaker 10, on Windows Xp.

                          • 10. Re: Swipe Magnetic Card "Behind the Scenes"

                            I checked the Select entire contents box, and it helped! Instead of having the "white line" extend aprox. 30-40 pixels, it was a static square that measured some 5-7 pixels each side... however still visible...

                            So what I did was:

                            You know how no matter what the line color for a field is, when it is selected to input data, it turns black? Well I made the field all black. Black Line, Black Fill, Black Font, now spell check... Then I gave it the visual appearance of a black line: long and narrow; acting like a border to the lower part of the layout.

                            Thats the best I could come up with for know. The only reason I can think of for the two different behaviors between your solution and mine is the FMP version 10x Version 11x. Hopefully moving forward Filemaker will 'correct' this issue...

                            Thanks again! Hopefully this thread will be usefully to others...