Jump to content

Barcode - UDF


Zedna
 Share

Recommended Posts

New version:

2012-06-04 - added Print + some inner optimizations

EDIT:

I tested it also with Barcode scanner in my work (only Code 128)

and it seems there is some problem on Windows7 64bit in GUI with font.

There are 3 bars at begin which shouldn't be there.

So when I do Screenshot of GUI with barcode on label and print this screenshot then scanner can't read it.

But when I print it by TextOut API (see Print() in my example) with the same font and the same data value

then output barcode on printer/paper is OK and can be read by scanner.

At home on my WindowsXP this bug doesn't occur.

So it may be some bug in TTF font on 64bit systems

or it can be bug in AutoIt in GUICtrlSetFont() only on 64bit systems

or it can be bug in AutoIt in GUICtrlSetData() only on 64bit systems

or something else ...

I will do more tests of this bug later.

Edited by Zedna
Link to comment
Share on other sites

  • 3 months later...

i am trying to print with a zebra lp2824 printer, but when i press print button, it just print an empty label. but using a normal printer, it print a complete A4 page with the input entered and the respective barcode.

what could i do to print just the barcode on the zebra lp2824 printer.??

thank you!!!

@zedna

Zedna

Edited by Alexisss
Link to comment
Share on other sites

Just my 2 pence - I dislike barcode fonts and prefer to manually code them. Attached is how I devised Code39 by using Wiki's table "Code Details", which saved me a huge amount of work. AFAIK there is no "limitation" to how long a Code39 can be, I capped it in my script to 16 characters because I use _ScreenCapture_CaptureWnd to grab a JPG which is used on address label sheets, so if anyone re-uses this make sure those dimensions will work for you.

Enjoy

Ian

PS @ Alexisss:

What happens if you try to print anything at all to the Zebra? Will it print plain text from Notepad? I've fixed plenty of Zebras but have never owned one to experiment.

Stripped Down Code39 Demo.au3

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.
Link to comment
Share on other sites

PS @ Alexisss:

What happens if you try to print anything at all to the Zebra? Will it print plain text from Notepad? I've fixed plenty of Zebras but have never owned one to experiment.

i just try to print a text plain from note pad, so it print a blank label!!!!

there is noy way to modify the barcode udr to print on a zebra printer??, i am using a 2 inch per 1 inch label

Link to comment
Share on other sites

  • 6 months later...

Hi Zedna,

I succesfully converted your example to print text and barcodes on a label(printer).

However for every new labelsize, I need to manually change the default papersize (via Printerproberties, General Tab, Preferences)

to print correctly.

I have analyzed your print.au3 and search with Google to find a way to send the papersize automatically before printing the label,

however I am over my head with DLLs and commands like DLLStructdata .

Could you (or other forummembers) help me out with changing the papersize (and printing orientation) ?

TIA, Jemboy

Link to comment
Share on other sites

Hi FireFox thanks for helping me find a solution.

I know "assumption is the mother of all f**kups", but I assume this size is more the size of the $tDOCINFO- "record" used (like a memory reservation.)

If it has something to do with the papersize, I think it's overwritten by the default papersize, input at the properties/preference of the Windows printer.

Also the value "20" isn't documented, is it A4, Letter size?

I have to little knowledge of DLL-archicture (shiver) to find find out.

Link to comment
Share on other sites

  • 5 months later...
  • Moderators

lishsewewe,

We do not accept adverts for payware apps. :naughty:

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

strange

I have a problem to run

"barcode_test.au3"

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "L:TOOLsMacro  TESTbarcode_autoitprint.au3" /UserParams    

+>13:02:49 Starting AutoIt3Wrapper v.2.1.2.28 SciTE v.3.3.2.0 ;  Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0415  Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.9.19)  from:C:Program Files (x86)AutoIt3Beta
"L:TOOLsMacro  TESTbarcode_autoitprint.au3"(75,75) : warning: $__WINAPCONSTANT_LOGPIXELSY: possibly used before declaration.
$PixelsPerInchY = _WinAPI_GetDeviceCaps($hDC, $__WINAPCONSTANT_LOGPIXELSY)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"L:TOOLsMacro  TESTbarcode_autoitprint.au3"(77,75) : warning: $__WINAPCONSTANT_LOGPIXELSX: possibly used before declaration.
$PixelsPerInchX = _WinAPI_GetDeviceCaps($hDC, $__WINAPCONSTANT_LOGPIXELSX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"L:TOOLsMacro  TESTbarcode_autoitprint.au3"(75,75) : error: $__WINAPCONSTANT_LOGPIXELSY: undeclared global variable.
$PixelsPerInchY = _WinAPI_GetDeviceCaps($hDC, $__WINAPCONSTANT_LOGPIXELSY)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"L:TOOLsMacro  TESTbarcode_autoitprint.au3"(77,75) : error: $__WINAPCONSTANT_LOGPIXELSX: undeclared global variable.
$PixelsPerInchX = _WinAPI_GetDeviceCaps($hDC, $__WINAPCONSTANT_LOGPIXELSX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
L:TOOLsMacro  TESTbarcode_autoitprint.au3 - 2 error(s), 2 warning(s)
!>13:02:49 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 2    Time: 1.155

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 Code * for 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 API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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

strange

I have a problem to run

"barcode_test.au3"

 

I use old AutoIt 3.2.12.1 where these constants are declared in standard WinAPI UDF

Global Const $__WINAPCONSTANT_LOGPIXELSX = 88
Global Const $__WINAPCONSTANT_LOGPIXELSY = 90

Just add these two lines of code to the top of print.au3 and it should work for you also with new version of AutoIt.

 

Link to comment
Share on other sites

thanks

now its works ..... nice

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 Code * for 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 API * ErrorLog.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 TaskScheduler * IE 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 stuff * OnHungApp handler * Avoid "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

Hello,

looks like the site http://grandzebu.net/informatique/codbar-en/code128.htm updated the code128.ttf font to V2.00 :
 

 

Version 2.00 of the font : The code of characters 95 and following was modified compared to the version 1.00. The encoding function was modified consequently.

 

Unfortunately this new font is not compatible with the actual code, the code need to be updated to use it.

Edited by cetipabo
Link to comment
Share on other sites

While this is all nice work, why don't someone port the functions of the free library Zint ?  There is a Delphi Wrapper here. There is both an exe and DLL option. My skills are not enough to port the Delphi code, unfortunately.

But you get almost all barcodes at once, even the most exotic ones. And putting Zint DLL into a zintbarcode.udf  would allow all applications to use barcodes for many projects.

Just my 2c. And it's not advertising for commercialware. Zint is opensourced.

I am just a hobby programmer, and nothing great to publish right now.

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...