Any barcode or magnetic strip reader that I've worked with enables you to program a "Post-Amble" for it. This is a character or string of characters that the scanner will automatically add to end of the stream of scanned characters input from the scanner. In keyboard emulation mode, that will appear as though a user had typed in the scanned barcode characters and then entered whatever characters make up the post-amble.
In fmp 10, you can make the post amble a tab, enter or return character. Set up your field behavior so this character exits the field you've setup as the target for your scanned barcodes. Now you can define a script trigger to kick in and do whatever you need when the field is exited.
In Pre-10 DBs, I'd do this by pausing a script in a loop and use an Enter key post-amble to continue the script. Code after the pause step would process the barcode scan just like the above script trigger does.
I found the barcode scanner book and I do see what you're talking about. I called our IT guys to help me set up the scanner for the post amble code. Once that is done, I'll probably need a little more help writing the script that will create the new record automatically.
thanks for pointing me in the right direction.
Again, Thank you for pointing me in the right direction regarding this issue. After reading the moderator post, I need to give some more information that would be helpful. I am using FMP v6 and using 10.5.8 Mac OS.
So I think I have the scanner programed correctly. I'm guessing that I would program an "enter" command to follow the scanned barcode. What kind of script should I create that would allow the barcode scanner and FMP to work together to create a new record automatically? I'm a little confused? I've written scripts before, but only ones that I would click on them to make them work. After the barcode is scanned, what should my script look like? and how is it activated?
Thank you for your time,
Define a global field to recieve the scanned data with post-amble.
Let's call it gBarCode.
Here's a possible script:
Go to layout [BarcodeScan]
Go to field [gBarCode]
Set FIeld [Barcode , BarcodeScan]
#do any other processing you need here.
Start this script to prepare fmp for scanning and then start scanning labels. The programmed "Enter" post-amble will continue the paused script each time you scan a label.
Since this loop is endless, you'll need a method to halt the script when you are finished scanning barcodes.
Set up any buttons on your script to perform a script and enable the Halt script step on the button setup options and then clicking any such button will also halt the above script. you can also write a one line script; Halt Script and assign it to a button to halt the scanning loop.
That works perfectly. Thank you so much for your help.
Note that with FMP 10 you can use an On Object Exit script trigger to process the scan and thus avoid the infinite loop that older versions require.
Thanks again for the info. I'm sure I'll be moving my databases to 10 sometime in the future, so I will definitely keep this thread in my notes.
Thank for your discussion, it help a lot. but i have kind of a problem i not work for me. I think my probleme is on the pause/resume, because i need to tell a certain period of time (indefinitly or seconde)
Thank again and sorry for my english.
" i need to tell a certain period of time"
I'm not sure what you mean by that. Do you need the script to pause for a specified lenght of time? Do you need to record the current time in a field when the barcod is scanned or do you mean something else?