Gollem Posted September 3, 2008 Posted September 3, 2008 For professional use I have develop a function witch generate barcode in ean13 standard with ean13.ttf font in pure autoit. To use it: You need to download the ean13.ttf from web. ( place it in windows\fonts) It work anywhere: Excel, Word, Filemaker,notepad, ... Feel free to include it in your scripts. Or save it as an include. param $chaine = first 12 digits of your ean. A feed back is welcome. gollem expandcollapse popupFunc _EAN13($chaine) ; Traduit par Gollem d'un forum Vbasic ;'Paramètres : une chaine de 12 chiffres ;'Retour : * une chaine qui, affichée avec la police EAN13.TTF, donne le code barre ;' * une chaine vide si paramètre fourni incorrect Dim $i, $checksum, $first, $CodeBarre, $tableA $EAN13 = "" ;'Vérifier qu'il y a 12 caractères If StringLen($chaine) = 12 Then ;Et que ce sont bien des chiffres For $i = 1 To 12 If Asc(STRINGMid($chaine, $i, 1)) < 48 Or Asc(stringMid($chaine, $i, 1)) > 57 Then $i = 0 Exit EndIf Next If $i = 13 Then ;'Calcul de la clé de contrôle For $i = 2 To 12 Step 2 $checksum = $checksum + stringMid($chaine, $i, 1) Next $checksum = $checksum * 3 For $i = 1 To 11 Step 2 $checksum = $checksum + stringMid($chaine, $i, 1) Next ;MsgBox(0,"checksum",$checksum) $chaine = $chaine & 10-(mod ($checksum,10)) ;MsgBox(0,"chaine",$chaine) ;Le premier chiffre est pris tel quel, le deuxième vient de la table A $CodeBarre = stringLeft($chaine, 1) & Chr(65 +(stringMid($chaine, 2, 1))) $first = stringLeft($chaine, 1) For $i = 3 To 7 $tableA = False Select Case $i = 3 if $first = 0 Then $tableA = True if $first = 1 Then $tableA = True if $first = 2 Then $tableA = True if $first = 3 Then $tableA = True Case $i = 4 if $first = 0 Then $tableA = True if $first = 4 Then $tableA = True if $first = 7 Then $tableA = True if $first = 8 Then $tableA = True Case $i = 5 if $first = 0 Then $tableA = True if $first = 1 Then $tableA = True if $first = 4 Then $tableA = True if $first = 5 Then $tableA = True if $first = 9 Then $tableA = True Case $i = 6 if $first = 0 Then $tableA = True if $first = 2 Then $tableA = True if $first = 5 Then $tableA = True if $first = 6 Then $tableA = True if $first = 7 Then $tableA = True Case $i = 7 if $first = 0 Then $tableA = True if $first = 3 Then $tableA = True if $first = 6 Then $tableA = True if $first = 8 Then $tableA = True if $first = 9 Then $tableA = True EndSelect If $tableA Then $CodeBarre = $CodeBarre & Chr(65 + stringMid($chaine, $i, 1)) Else $CodeBarre = $CodeBarre & Chr(75 + stringMid($chaine, $i, 1)) EndIf Next $CodeBarre = $CodeBarre & "*" ;'Ajout séparateur central For $i = 8 To 13 $CodeBarre = $CodeBarre & Chr(97 + stringMid($chaine, $i, 1)) Next $CodeBarre = $CodeBarre & "+" ;'Ajout de la marque de fin $EAN13 = $CodeBarre return $ean13 EndIf EndIf EndFunc
ptrex Posted September 4, 2008 Posted September 4, 2008 @GollemMaybe this might be interesting you.No need of a TTF.Printing BarCodeRegardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now