Barcode Scanner

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Barcode Scanner

Post by Quinton B. » Fri Dec 28, 2018 2:32 am

Good evening.
Can anyone point me in the correct direction of a barcode scanner for LiveCode?
The following link is one that shows where the forms of data I need to pull into the application for use in a login system: https://www.reddit.com/r/AirForce/comme ... fficiency/

But I need to translate this into LiveCode.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Barcode Scanner

Post by bangkok » Fri Dec 28, 2018 5:29 am

Quinton B. wrote:
Fri Dec 28, 2018 2:32 am
Can anyone point me in the correct direction of a barcode scanner for LiveCode?
The following link is one that shows where the forms of data I need to pull into the application for use in a login system: https://www.reddit.com/r/AirForce/comme ... fficiency/
What does :
-a barcode scanner (connected to a PC via USB port for instance)
-an android terminal with an integrated barcode scanner

?
.. most of those devices... just "emulate" a "keyboard" when they read a barcode !

AKA : when you scan a barcode... a string of characters is sent to the computer, like if it was typed on its keyboard.

Therefore : Livecode can without any problem "catch" on the fly those characters and take proper action.

On PC (windows or macos) it's very easy. On your script card, use

Code: Select all

on keyDown theKey
...
end KeyDown
You just have to add a control character at the beginning of the scan and at the end, so LC can know when the barcode is complete (with a start and and end)

All barcode scanners can be programmed and the addition of a "suffix" and "prefix" is easy.

A more basic solution would be to just open a field on your LC card, and scan a barcode and then click a button.
Or : add a "CR" as "suffix" on your scanner, and then

Code: Select all

on returninfield
...
end returninfield
in your field script.

There are many ways actually to deal with the data sent by barcode scanner.

On Android, it's more tricky, because you need to have a focus... in a field. Unless you find a device with a special external developped for LC (but it doesnt seem to exist yet).

Quinton B.
Posts: 108
Joined: Mon Mar 20, 2017 5:13 am

Re: Barcode Scanner

Post by Quinton B. » Fri Dec 28, 2018 10:09 pm

I'm primarily focused on the integrated camera in the Android phone itself, not an external source.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Barcode Scanner

Post by jacque » Sat Dec 29, 2018 6:11 pm

There's one for iOS but nothing for Android yet. If you're up for working with LCB then that would be the way to go, I think.

Edit: I looked at the link you posted and while it tells you what the numbers mean, it assumes an external reader that translates the image to text content. You could probably read the raw image data byte by byte and figure out how to translate the wide and narrow stripes, then use the info in the link to read the resulting numbers. (There are several different barcodes types so that link may not be accurate for the barcodes you'll be using.) That way you could do it all in LCS.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”