Barcode Generation?

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

Xero
Posts: 157
Joined: Sat Jun 23, 2018 2:22 pm

Re: Barcode Generation?

Post by Xero » Fri Dec 24, 2021 2:16 pm

EDITED:
I had a look into barcode generation and thought it might be a fun little project. Only took a day, but managed to get proof of concept.
Managed to get a barcode generated, and scanned online for a correct reading. Startcode, code, checksum and Endcode. My previous file was using incorrect checksum values and had the incorrect offset of line for selecting code blocks. All have been corrected.
Only for 128 Code B, and only for numbers. It basically works off a table, and I couldn't be bothered getting too far down that rabbit hole to go outside numbers only.
Can be scaled up to the rest of the codes, addition of letters and other characters. I haven't added the tables, but they are easy enough to find through somewhere like Honeywell, Wikipedia, etc. That's where I got this data from.
All of the scripting is done in the "GO!" button.
It still has a few hiccups like the "input" word gets covered with a graphic...
Enjoy.
XdM
Attachments
BarcodeGen.zip
(2.54 KiB) Downloaded 158 times
Last edited by Xero on Sat Dec 25, 2021 3:33 pm, edited 1 time in total.

cmhjon
Posts: 190
Joined: Tue Aug 04, 2015 11:55 am

Re: Barcode Generation?

Post by cmhjon » Fri Dec 24, 2021 10:11 pm

Hi Xero,

Thank you so much for the reply. I gave your POC a whirl (VERY cool by the way!!!). I tried creating a barcode of "123". The generated barcode was scannable by the barcode scanning app on my Android phone but what's interesting is that it read as a UPC-E barcode. I went to a website that generates Code 128B barcodes and tried "123". The generated barcode scanned as a Code 128 barcode and the bar sequence was a little different visually. I want to do some more testing.

Again, thank you so much!!!
Jon :)

Xero
Posts: 157
Joined: Sat Jun 23, 2018 2:22 pm

Re: Barcode Generation?

Post by Xero » Fri Dec 24, 2021 11:00 pm

I did a quick check and it looks like at least my checksum calc is incorrect. It should be reading the character number (line in table) not the number itself.... As long as it reads the right code, I guess it's a win.
I am just using random tables off the internet and am not an expert. I will look through it again and do a little changing.
Anyway, that should set you up with everything you need to write the barcode. You will just need to fill in any blanks with tables, charactersets, etc. to use different code bases, different types, etc. It will just mean taking some time to copy over the tables into some containers within the stack and adding a line to reference the right container. I am sure using arrays would also speed it up.
Good luck and feel free to post your working here so we ca all enjoy!
XdM

cmhjon
Posts: 190
Joined: Tue Aug 04, 2015 11:55 am

Re: Barcode Generation?

Post by cmhjon » Sat Dec 25, 2021 12:17 am

Hi Xero,

Thanks again for your help. All this is over my head so I'm going to need to spend some time dissecting the code to try and understand how it all works. Since originally posting this thread, I found a website that does online barcode generation and provides the HTML code that can be used to embed into a web page. Fortunately, LC has an HTMLtext command that can show the result of HTML code in a field. While this works, I like your example better because it's all self-contained with no need of external resources.

Best regards,
Jon :)

Xero
Posts: 157
Joined: Sat Jun 23, 2018 2:22 pm

Re: Barcode Generation?

Post by Xero » Sat Dec 25, 2021 3:34 pm

Hey cmhjon,
I have just updated a previous post to include a revised file that now works. I have generated an online barcode and verified that the output I am getting matches. Also scanned it with an online reader for a correct scan.
XdM

cmhjon
Posts: 190
Joined: Tue Aug 04, 2015 11:55 am

Re: Barcode Generation?

Post by cmhjon » Wed Dec 29, 2021 4:58 pm

Hi Xero,

Finally circling back to this. Yup! Scanned and read correctly! Thank you so much!

Best regards,
Jon :)

Post Reply