Jump to content

Barcode Generators


willichan
 Share

Recommended Posts

As I have time, I am converting my old barcode generators from old Pascal source to AutoIt.  I will add them all here as I convert them, rather than creating a new topic for each one.

There are no global variables involved, so you can safely include any of these without worry about variables being stomped on.

No barcode fonts required.

Code128AutoCreates a Code128A/B/C optimized barcode from supplied data

Code39Creates a Code39 or Code39Extended (with or without check-character) barcode from supplied data (also known as Code 3 of 9).

CODABAR - Creates a CODABAR barcode from supplied data (used mainly by libraries and blood banks)

NOTE:  These will require the StringSize UDF by Melba23

==========

CodeQR - Creates a QRcode from supplied data.

Edited by willichan
Updated tags
Link to comment
Share on other sites

Thanks for sharing.
Generated bmp files looks realy good.

mLipok

 

ps.
I add your UDF to the list:
https://www.autoitscript.com/wiki/User_Defined_Functions#Misc

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Nice additions!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Thank you both.

As soon as I figure out how to put the images on the clipboard without saving to a BMP file first, I will add that to them as well.

Link to comment
Share on other sites

Technically, this is just an implementation of a QRcode dll, and several others have posted their own implementations, but I thought it fit well with this collection.

CodeQR.zip

Requires quricol32.dll from http://delphi32.blogspot.it/2011/11/quricol-qr-code-generator-library.html

The quricol author seems to have relocated the download.  The new link is here:

https://perevoznyk.wordpress.com/2013/09/11/quricol-2-0-qr-code-generator/

Looks like it has moved again.  Quricol is now hosted on Github.  Here is the new download link.

https://github.com/perevoznyk/quricol/releases

Edited by willichan
new link
Link to comment
Share on other sites

Added CODABAR for working with libraries and blood banks.

Allows you to select start/stop codes customized to the application.  Recognizes both "ABCD" and "TN*E" notations.

Extended characters (-$:/.+) are supported by the UDF, but most scanners do not support them and get confused when they are used.

Edited by willichan
typo/spelling
Link to comment
Share on other sites

  • 4 weeks later...

I am using the 128 barcode generator, and it works pretty good. How difficult would it be to refactor the code so you can state an explicit width / height for the image? I gave this a try myself but I don't understand the code enough.


I also think I found a bug. I made a few barcodes, using the same number while changing the DPI, but at higher DPI's it starts cutting off the top and bottom of the barcode. Perhaps some math for margins / padding is off?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

  • 2 weeks later...

I am using the 128 barcode generator, and it works pretty good. How difficult would it be to refactor the code so you can state an explicit width / height for the image? I gave this a try myself but I don't understand the code enough.


I also think I found a bug. I made a few barcodes, using the same number while changing the DPI, but at higher DPI's it starts cutting off the top and bottom of the barcode. Perhaps some math for margins / padding is off?

​You can (sort of) specify a height by setting $fBarHeight.  Width will vary depending on the length of the code.  If you need a specific width/height, you may need to look at resizing the generated BMP, though I would not recommend it, since your bar codes may not be readable after resizing.  These bar code routines adhere to the particular bar code format specifications.  For the Code128 bar codes, I use the GS1-128 specification.

If you need a fixed width bar code (and all of the codes you are encoding are the same length) you might want to use 3of9 instead.

 

Link to comment
Share on other sites

I did a bit of messing about and came up with this. IT basicly lets you set a height, width, font size, and padding, and then will try and make a barcode that fits that.
 

Func GenerateBarcodeImage($barcodestring, $width, $height, $File = Default, $FontSize = Default, $iPadding = Default, $DPI = Default, $DPIresize = Default)
  $bits = __Bcode128_EncodeData($barcodestring)
  $bits = $bits[0]

  If $DPI = Default then $DPI = 96
  If $iPadding = Default then $iPadding = 15
  If $DPIresize = Default then $DPIresize = 0
  If $FontSize = Default then $FontSize = Ceiling($height/10)
  If $file = Default then $file = @TempDir&"\LCS\"&$barcodestring&".bmp"
  DirCreate(StringLeft($file, StringInStr($file, "\", 0, -1)))

  ConsoleWrite($FontSize&@CRLF)

  Local $iBarHeight = $height - $iPadding*2
  If $FontSize > 0 Then $iBarHeight -= $FontSize+2
  Local $fMinBar = 0.015 ; of an inch
  Local $iBarWidth = Ceiling($DPI * $fMinBar)

  If $DPIresize Then
  For $iBarWidth = $iBarWidth + $DPIresize to $iBarWidth - $DPIresize step -1
    If $iBarWidth*StringLen($bits) <= $width Then ExitLoop
    If $iBarWidth = 1 then ExitLoop
  Next
  EndIf

  If $iBarWidth*StringLen($bits) > $width Then
  ConsoleWrite("Caution: Barcode width ("&$iBarWidth*StringLen($bits)&") is wider than the image width! ("&$width&")"&@CRLF)
  EndIf

  #include <GDIPlus.au3>

  ;;create image
  _GDIPlus_Startup()

  Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($width, $height, $GDIP_PXF01INDEXED)
  __Bcode128_BitmapSetResolution($hBitmap, $DPI, $DPI)

  Local $sCLSID = _GDIPlus_EncodersGetCLSID("bmp")
  Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
  _GDIPlus_GraphicsSetSmoothingMode($hBmpCtxt, 0)
  _GDIPlus_GraphicsClear($hBmpCtxt, 0xFFFFFFFF)

  ;;draw lines
  For $i = 1 To StringLen($bits)
    If StringMid($bits, $i, 1) = 1 Then
    $cx = ($width/2) - (StringLen($bits)*$iBarWidth/2) + (($i-1) * $iBarWidth)
    _GDIPlus_GraphicsFillRect($hBmpCtxt, $cx, $iPadding, $iBarWidth, $iBarHeight, 0)
    If @error Then ConsoleWrite("unable to draw bar " & $i & @CRLF)
    EndIf
  Next

  If $FontSize <> 0 and $barcodestring <> "" Then
    ;;add text to bottom
    $i = _StringSize(String($barcodestring), $FontSize, Default, Default, "Arial")
    $cx = ($width/2) - ($i[2]*1.16 / 2)
    _GDIPlus_GraphicsDrawString($hBmpCtxt, $barcodestring, $cx, $iBarHeight + $iPadding, "Arial", $FontSize)
    If @error Then ConsoleWrite("unable to draw text - " & @extended & @CRLF)
  EndIf

  FileDelete($file)
  ;;save and dispose of image
  _GDIPlus_ImageSaveToFile($hBitmap, $file)
  If @error Then ConsoleWrite("unable to write to file" & $file & @CRLF)
  _GDIPlus_GraphicsDispose($hBmpCtxt)
  _GDIPlus_BitmapDispose($hBitmap)
  _GDIPlus_Shutdown()
  If FileExists($file) then Return $file
  Return 0
EndFunc

It uses your udf, I just changed / rewrote the barcode generation bit. There are options for automatic scaling of the barcode to keep it within the width, as well as the option to set padding and explicit font size. Perhaps someone will find this useful.

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Thanks a lot for sharing it with us.

I got this error when I'm trying to run any of the examples:

Code39.au3"(92,40) : warning: $__g_hGDIPDll: possibly used before declaration.

Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipBitmapSetResolution", "handle", $hBitmap, "float", $nDpiX, "float", $nDpiY)

I'm on Autoit 3.3.12. Any help would be pretty apreciatted.

Greets from Barcelona

Edited by Qwerty212
Link to comment
Share on other sites

Qwerty212,

Are you running the Code39Demo.au3 to get that error?
Are you running it within the SciTe editor?
What changes have you made to the script?

I am unable to reproduce your problem.  $__g_hGDIPDll is defined in the standard GDIPlus.au3 UDF, which is included at the top of the Code39 UDF, so it should be defined.

Link to comment
Share on other sites

Maybe the poster doesn't use an up-to-date version of AutoIt.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I'm on SciTe Version 3.4.4  and Auoit 3.3.12 on a Windows 7 SP1 x64

I'll try to make some more test with other computers during the weekend.

By the way I can not stop thanking you for the QR code generator.

 

EDIT:

Sorry for any incovenience. I has copied the old Include folder over the new one after the installation.

Now your examples do work like a charm. Unfortunately now I need to find a work around for some script breaking changes :(

 

Thanks a lot.

 

Greets from Barcelona

Edited by Qwerty212
problem solved
Link to comment
Share on other sites

Code39, Code128Auto and CodeCODABAR have been updated.

Fixed issue where a blank label area was still created, even if the no label option was selected.

Support for copying the barcode to the clipboard instead of saving to a file has been added.

Link to comment
Share on other sites

Wow I searched for "AutoIT QRCode" and never found this instead I found a much older UDF from 2012 that was not very good.

I continued my search and finally found the cmd driven QRCode generator that the .dll is based on and write an entire GUI based around using that .exe

Wonder if it is worth moving to your UDF and using the DLL instead, the only real difference other than having a native UDF vs using a CMD @COMSPEC is that the UDF produces a .bmp while the .exe produces a .png

Also there is a new version of the DLL if you wanted to add any features to the UDF:

http://delphi32.blogspot.com/2013/09/quricol-20-qr-code-generator.html?_sm_au_=iQVPpLsPC546MqkP

 

My "Wrapper" for qrcode.exe

The Manufacture Date stuff is based on HP computers where the date is part of the serial number, but this was just something I put together so we can barcode our computers quickly. 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <CompInfo.au3>
#Include <Date.au3>
#Include <File.au3>

If NOT FileExists(@ScriptDir & "\QRCode.exe") Then
    MsgBox(0, "Black Magic Automation", "QRCode.exe is missing and required, please move to same directory and retry.")
    Exit
EndIf

#Region ### START Koda GUI section ### Form=c:\users\it022565\desktop\auto barcode\form1.kxf
$Form1_1 = GUICreate("Black Magic Automation QR Code Generator", 488, 485, 244, 163)
$Edit1 = GUICtrlCreateEdit("", 24, 344, 273, 129, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "Press Update Barcode Info")
$ModSize = GUICtrlCreateInput("ModSize", 40, 65, 121, 21)
$MarginSize = GUICtrlCreateInput("MarginSize", 192, 65, 121, 21)
$Radio1 = GUICtrlCreateRadio("Low", 352, 64, 113, 17)
$Radio2 = GUICtrlCreateRadio("Medium", 352, 80, 113, 17)
$Radio3 = GUICtrlCreateRadio("Quartile", 352, 96, 113, 17)
$Radio4 = GUICtrlCreateRadio("High", 352, 112, 113, 17)
$Label1 = GUICtrlCreateLabel("Automatic Computer Barcode Generator", 88, 0, 327, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Module Size (Pixels)", 56, 48, 98, 17)
$Label3 = GUICtrlCreateLabel("Margin Size (Pixels)", 208, 48, 95, 17)
$Label4 = GUICtrlCreateLabel("Error Correction", 352, 48, 77, 17)
$Button1 = GUICtrlCreateButton("Generate!", 336, 360, 123, 89)
$Label5 = GUICtrlCreateLabel("QR Settings", 200, 32, 72, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("Computer Data Import", 176, 144, 127, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Manufactured Date", 32, 168, 96, 17)
$Label8 = GUICtrlCreateLabel("Replacement Plan (Years)", 176, 168, 127, 17)
$Label9 = GUICtrlCreateLabel("Replacment Date", 336, 168, 87, 17)
$ManDate = GUICtrlCreateInput("ManDate", 16, 184, 121, 21)
$Years = GUICtrlCreateInput("Years", 176, 184, 121, 21)
$ReplaceDate = GUICtrlCreateInput("ReplaceDate", 328, 184, 121, 21)
$Button2 = GUICtrlCreateButton("Update Barcode Data", 104, 264, 273, 33)
$Label10 = GUICtrlCreateLabel("Barcode Data", 208, 312, 82, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("Asset Tag", 48, 216, 52, 17)
$Label12 = GUICtrlCreateLabel("IMEI Number", 200, 216, 66, 17)
$Label13 = GUICtrlCreateLabel("SIM ICC ID", 352, 216, 57, 17)
$Asset = GUICtrlCreateInput("Asset", 16, 232, 121, 21)
$IMEI = GUICtrlCreateInput("IMEI", 176, 232, 121, 21)
$SIM = GUICtrlCreateInput("SIM", 328, 232, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Dim $BIOS
_ComputerGetBIOS($BIOS)
$Manufacturer = $BIOS[1][12]
$Serial = $BIOS[1][16]

GUICtrlSetData($ModSize, 3)
GUICtrlSetData($MarginSize, 0)
GUICtrlSetState($Radio4, $GUI_CHECKED)
GUICtrlSetData($ManDate, MDate($Serial))
GUICtrlSetData($Years, 5)
GUICtrlSetData($ReplaceDate, MDate($Serial, GUICtrlRead($Years)))
$Updatecheck = GUICtrlRead($Years)
GUICtrlSetData($Asset, "N/A")
GUICtrlSetData($IMEI, "N/A")
GUICtrlSetData($SIM, "N/A")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            $ALLURBASE = ""
            $ALLURBASE = $Manufacturer & @CRLF
            $ALLURBASE &= "Serial# " & $Serial & @CRLF
            If GUICtrlRead($Asset) <> "N/A" Then $ALLURBASE &= "Asset# " & GUICtrlRead($asset) & @CRLF
            If GUICtrlRead($IMEI) <> "N/A" Then $ALLURBASE &= "IMEI# " & GUICtrlRead($IMEI) & @CRLF
            If GUICtrlRead($SIM) <> "N/A" Then $ALLURBASE &= "SIM# " & GUICtrlRead($SIM) & @CRLF
            $ALLURBASE &= "Deployment Date " & GUICtrlRead($ManDate) & @CRLF
            $AllURBASE &= "Replacement Date " & GUICtrlRead($ReplaceDate)
            GUICtrlSetData($Edit1, $ALLURBASE)
        Case $Button1
            DirCreate(@ScriptDir & "\GeneratedCodes\")
            _FileCreate(@ScriptDir & "\LastBarcode.txt")
            FileWrite(@ScriptDir & "\LastBarcode.txt", GUICtrlRead($Edit1))
            $size = GUICtrlRead($ModSize)
            $margine = GUICtrlRead($MarginSize)
            $errorcorrect = CheckRadio()

            Run(@ComSpec & " /c qrcode.exe -o GeneratedCodes\" & @ComputerName & ".png -l " & $errorcorrect & " -s " & $size & " -m " & $margine & " < lastbarcode.txt")

            MsgBox(0, "Black Magic Automation", "QRCode Created as " & @ComputerName & ".png")

    EndSwitch


    If GUICtrlRead($Years) <> $Updatecheck Then GUICtrlSetData($ReplaceDate, MDate($Serial, GUICtrlRead($Years)))
    $Updatecheck = GUICtrlRead($Years)
WEnd


Func MDate($vSerial,$yplus=0, $mplus=0, $dplus=0)

$Year = (StringMid(@Year, 1, 3) & StringMid($vSerial, 4, 1)) + $yplus
$Week = StringMid($vSerial, 5, 2)
$RawMonth = $Week /4
$aMonth = StringSplit($RawMonth, ".")
$Month = $aMonth[1]

If $aMonth[0] = 2 Then
Switch $aMonth[2]
    Case 25
        $Day = "07"
    Case 5
        $Day = "14"
    Case 75
        $Day = "21"
    EndSwitch
Else
$Day = "01"
EndIf

$Manufacture = $Month & "/" & $Day & "/" & $Year
Return $Manufacture
EndFunc

Func CheckRadio()
    If GUICtrlRead($Radio1) = $GUI_CHECKED Then Return "L"
    If GUICtrlRead($Radio2) = $GUI_CHECKED Then Return "M"
    If GUICtrlRead($Radio3) = $GUI_CHECKED Then Return "Q"
    If GUICtrlRead($Radio4) = $GUI_CHECKED Then Return "H"
EndFunc
Edited by ViciousXUSMC
Link to comment
Share on other sites

Just thought I would check back in.

I modified the above to incorporate the .dll and your UDF.  

Your defaults were a bit different than what I was using so I changed the defaults and expected to get the same result but they are different.

I think its because the .exe is detecting the need for a higher "version" of QR

Attached is a 111x111 .bmp created with the qrcode.udf and a 159x159 .png created by the qrcode.exe

 

Edit: I think its the error correction I get High with the .exe but Low with the .UDF I have tried both the letter and number so far with no change so I will have to look into it further to see why its not working.

 

Edit2: I do not know much about .dll and all that but looking in the files 

Edit3: Figured it out!

In the .UDF Change This:

If $vErrorCorrect = Default Then
        $vErrorCorrect = 'M'
    Else
        Switch StringLower($vErrorCorrect)
            Case '0', 'l', 'low'
                $vErrorCorrect = 'L'
            Case '1', 'm', 'medium'
                $vErrorCorrect = 'M'
            Case '2', 'q', 'quality'
                $vErrorCorrect = 'Q'
            Case '3', 'h', 'high'
                $vErrorCorrect = 'H'
            Case Else
                Return ""
        EndSwitch
    EndIf

To This:

If $vErrorCorrect = Default Then
        $vErrorCorrect = 'M'
    Else
        Switch StringLower($vErrorCorrect)
            Case '0', 'l', 'low'
                $vErrorCorrect = '0'
            Case '1', 'm', 'medium'
                $vErrorCorrect = '1'
            Case '2', 'q', 'quality'
                $vErrorCorrect = '2'
            Case '3', 'h', 'high'
                $vErrorCorrect = '3'
            Case Else
                Return ""
        EndSwitch
    EndIf

I also found I can just flip "GenerateBMP" to "GeneratePNG" to get a PNG image instead that is 1/10 the size.

DIT01500N255.bmp

DIT01500N255.png

Edited by ViciousXUSMC
Link to comment
Share on other sites

  • 2 weeks later...

I kept it as BMP for ease of use and consistency, but could add the PNG option to it.  I'll see how soon I can put a few minutes toward it.

Link to comment
Share on other sites

  • 3 years later...
  • 2 weeks later...
On 14/9/2018 at 5:22 PM, meomeo192 said:

I user from 1 to 7 characters, all are number, i want the barcode is short to can print in the little paper, the QR code is not accept because my reader dose not support. Can you give me a ideal? Thank you very much.

Easy, create some Control Characters:  In my apps, when I need someone to read a specific qr, I start it with a symbol (a #, a @, a combination of characters like "#RM:").

You can create your QR codes with a fixed combination like "#THISISMYQR:" & $data

Doing this, your QRs will always have, at least, 12 characters. In the reading program, you can do then 2 things: Discard any QR that doesn't start with this data: "#THISISMYQR:" and to get the real value of the QR you can do something as easy as:

 

; Lets asume that you have readed a QR and the readed data is stored in the variable $datareaded

Local $check = StringLeft($datareaded, 12) ; We check that the qr is one of those that we have created for our pourpose

        If $check = "#THISISMYQR:" Then  ;it is one of our QRs
            Local $finaldata = Stringtrimleft($datareaded,12)
            MsgBox(0, "FINE", "The data inside our QR was: " & finaldata)
        Else
            MsgBox(0, "ERROR", "This QR was not created by me. The data stored inside it was: " & datareaded)
        Endif

 Greets from Barcelona

 

 

Edit: sorry, I readed really fast and I missed the non qr reader 😅

Edited by Qwerty212
Link to comment
Share on other sites

On 9/14/2018 at 8:22 AM, meomeo192 said:

I user from 1 to 7 characters, all are number, i want the barcode is short to can print in the little paper, the QR code is not accept because my reader dose not support. Can you give me a ideal? Thank you very much.

Code39 should probably work well for you.

Edited by willichan
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...