Page 1 of 1

Barcode Scanner

Posted: Fri Dec 28, 2018 2:32 am
by Quinton B.
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.

Re: Barcode Scanner

Posted: Fri Dec 28, 2018 5:29 am
by bangkok
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).

Re: Barcode Scanner

Posted: Fri Dec 28, 2018 10:09 pm
by Quinton B.
I'm primarily focused on the integrated camera in the Android phone itself, not an external source.

Re: Barcode Scanner

Posted: Sat Dec 29, 2018 6:11 pm
by jacque
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.