by Peter Vinogradov

Adventures in Barcoding

Adventures in Barcoding

As a fulltime educator, there’s never any shortage of new and exciting projects to inspire me and capture my interest. As an FM developer, though, it can sometimes be a bit of a stretch. Even new releases of FileMaker (like that‘ll happen any time soon…) can be a melancholy blend of “gee whiz” moments and feature request letdowns (”what?! They didn’t include facial recognition on container fields?! Damnit, I’ve been asking for that since version 4!”). Fortunately, we can sometimes count on our clients to throw something fun our way.

Recently, a client asked me if we could integrate barcode scanning into their solution. It was a simple problem – set up a workstation so that the user could scan items off a catalog and have them end up in a proposal. For me though, I have to confess a little hesitation. As far as I was concerned, barcodes are for the big boys like Walmart and my public library. Item Selection Club SandwichWhy couldn’t my client just get by with the FileMaker value lists I had painstakingly set up for them (My specialty, the “item selection club sandwich”, stacked 12 deep with key-based dropdowns, masking popup menus, scriptevent plain entry, type-aheads, conditional container fields, mayonnaise, etc.). Anyway, I’d heard of barcodes, and understood the concept, so I said what the heck.

The Symbol (Motorola) LS2208After shopping a bit, I found a scanner, ordered it and set about reading the Wikipedia entries on barcode symbologies. When I awoke three days later, the scanner had arrived (Symbol LS2208). I recommend this unit, but if you buy it, don’t order the “multi-interface” version unless you have some clue how to make the phone-jack-looking “multi-interface” end of the cable fit into your computer. The USB version, on the other hand, is really cool, and it was only a matter of seconds before I was scanning everything in my office and marveling at the little numbers getting magically typed into notepad.

If you’re integrating barcode scanning inFather’s Day Shirtto a solution for the first time, and are simple-minded, be sure to plan for this phase of idiotic wonder, as it can be time-consuming. If you choose to bill your clients for it, then let me save them some money and share my research notes on this phase:

With this research out of the way, I began to think about how to integrate my scanner with FileMaker. In it’s simplest form, you could click into a field, scan a barcode, and have that code appear in the field. Time-saving and cool, but it still falls well short of the kind of functionality your local grocer takes for granted. Ideally, you want each scan to trigger a script, and you want that script to take the contents of your scan and deliver it to the right place, and you want to be able to do everything without going back to your keyboard or moving your mouse. In fact, if you could do it without looking at the screen, that would be an even bigger bonus.

Possibly the simplest approach (other than the lame one described previously) would be to have a big global field to collect your scans, along with a button to parse the collected scans when you’re all done. To do this, though, you need a way for your scans to separate with carriage returns. Enter the world of ADF (stands for: awesome dynamic fun – look it up) rules, which are little macros that you can teach your scanner to perform every time it scans something. Luckily the LS2208 Quickstart Guide comes with a series of three barcodes just for this purpose. Scan them in order, and magically, your scanner will insert a carriage return after every scan.

123Scan Rules DialogWhile I had considered this approach briefly, it felt a bit cheap and it didn’t provide the user enough feedback to let them know what they were scanning (a field full of ID codes isn’t very friendly). So, I cracked open the 400 page PDF that comes with the LS2208 and started learning more about ADF. From my initial read, it looked like the way to teach my scanner to do fancy scanner tricks was to jump around the 400-page PDF, work out the proper series of steps, represented as barcodes, and scan them in exactly the right order (and of course, from my research in the idiotic wonder phase, I knew I would have to do a lot of printing since I couldn’t scan off the screen). So while I found all these magic ADF barcodes to be really neat, in theory, I began to wonder whether the people at Symbol (Motorola) might not have bothered to write some software to handle all of this. Digging around in my LS2208 CD, I discovered exactly that, a little utility called 123Scan. I ran it, and spent an hour and a half trying to get it to talk to my scanner. A quick trip to the PDF let me know that it would only work if my scanner was connected by RS232 serial cable. I was about to resign myself to hours of tedious flipping through the PDF when I discovered that I could use 123Scan to generate a script of ADF barcodes and send them to my printer. Happy Day.

ADF - begin new ruleSend CTRL+6So, first order of business was to get FileMaker to execute a script when a barcode got scanned. What I figured I could do was use the ADF rules to prepend a keyboard shortcut to the front of each scan. I really wanted something out-of-the-way, like CTRL+ALT+SHIFT+6, but it didn’t seem like ADF could get that fancy. CTRL+6 would have to do. In FileMaker, I set up a custom menu for my script and gave it the CTRL+6 shortcut.

 

ADF - Send Pause

ADF - Send the RestMy next concern was the time lag between launching the script and handling the remaining data. I didn’t want the barcode data stream to get lost while FileMaker was trying to get a script in gear. Fortunately, ADF allows you to set pauses, so I did (with a little experimenting, it seemed like 0.4 seconds was as short as I could make it and still have it be reliable).

Finally, I knew I would need an enter key (the keypad variety, not the keyboard version), and a beep at the end to let the user know the scanner was ready to go again.

With all of that set up in 123Scan I printed up the ADF barcode instruction series, scanned it into my LS2208 and behold, it worked. What followed, of course, was another hour or so of Idiotic Wonder – “Does it really work? Wow. What happens if I scan this? Wow. What about this? Wow. What about from 2 feet away? Wow. Etc.”

Data Stream Capture DialogOf course, you do have to think about what you want your FM script to do with its data stream. After some experimenting, I settled on having it invoke a custom dialog with the title “Gathering Barcode” and a single global variable input field. With the “Enter” key suffixed by ADF rules, this dialog only flashes for a second and I kind of like the visual feedback. With this barcode collected, I could safely process the input, manage context, error trap, etc.

Another gotcha is the possibility of unfriendly barcodes. Suppose someone accidentally (read: inquisitively) scans their gym pass. In my case, I knew all the “good” barcodes would represent ID numbers with the same common two-letter prefix. It took some fiddling, but I was able to organize my ADF rules so that barcodes without the prefix would just generate a beep and pass nothing to the computer.

Finally, what about generating the barcodes themselves? My client assures me that they have an office supply vendor who will generate sequential barcode stickers for all items going forward, but I also wanted the option of generating the occasional set of labels in-house. Working together, Google and I turned up this handy tool: http://www.barcodemill.com/index.php Which also includes a neat little image tool you could work into a web viewer: http://www.barcodemill.com/tech/index.php?load=/tech/install/millfree.php (I’m not sure the operator would look favorably on an industrial-strength application of this – they do have a commercial version – but I imagine the occasional lookup wouldn’t hurt). If someone out there knows of a better free barcode generator, please post below.

As for symbology, I settled on Code 128. It supports a full ASCII set and is relatively compact. The next phase of this project is going to involve a mobile solution for walking around a showroom floor and collecting items to upload later. I’ve set aside a full two days for idiotic wonder when that hardware comes in…

alphabet in Code 128 from BarcodeMill.com

Comments

2 Responses to “Adventures in Barcoding”

  1. Peter Vinogradov on June 9th, 2007 10:14 pm

    This site:

    http://posworld.com/onbargen.html

    has a wider variety of generators than barcodemill. They seem much peppier and their terms of use seem vague to benevolent: “Create barcodes online for testing or whatever you like! No need to give us your email address or worry about us charging for this service in the future. ”

    With a little poking around the source, it’s easy to see how to formulate an image URL to use in a web viewer.

  2. nealibob on August 23rd, 2007 2:47 pm

    There are a number of free or cheap barcode fonts available:

    http://freebarcodefonts.dobsonsw.com/index.html
    http://www.idautomation.com/fonts/free/

    There are many more, just do a quick Google search to see.

    While there is merit to using image-based barcodes (consistency, ease of deployment, etc.), I prefer to use fonts because they tend to be easier to work with in FileMaker, and they are more versatile.

Leave a Reply

You must be logged in to post a comment.