Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/09/2023 in all areas

  1. Progress Update Probably going to have the first "concept" demo version 0.01 ready by the end of this weekend (November 12, 2023 IF NOT SOONER), NO PROMISES AND FINGERS CROSSED. If all continues to go well. That's the goal anyways. If something happens or I experience delays, I will update you guys here on the 12th. I'm getting burned out, I need to take a break to work on some other projects and other stuff. Also starting to need support for this project, I've been working diligently on this since July to get it to this point. I'll tell you now, full screen won't be available YET. Offline only, leaving out the IRC/online stuff, temporarily of course, since a lot of that isn't even close to finished. This first demo will be the basics; Testing the engine itself. There is still a lot more to do, but what I have so far needs to be tested and analyzed by other AutoIt programmers. As I've said before I am by no means a "professional" programmer, nor am I 100% fluent in AutoIt, there are areas of this project where I feel like the code is messy, or just thrown together. It does work fairly well considering, and runs relatively stable, but just because it (mostly) works without error, doesn't mean it can't be improved! More info to come.
    3 points
  2. This Beta version contains SciTE v 5.4.0 and a major change to the AutoComplete functionality and automatically addition of required #include lines at the top. Many LUA functions are updated. 2023-12-27 13:30 Merged SciTE Release 5.4.0 with the SciTE4AutoIt3 sources Many changes to the new LUA functions 2023-03-10 13:00 Merged SciTE Release 5.3.4 with the SciTE4AutoIt3 sources Added option to jump to the definition of a Variable when Ctrl+J is used with the caret placed with a variable name. Many other small changes... see this thread for details Move the zip into the Beta directory making it for more people available. Move this thread to AutoIt Technical discussions, so others can participate in testing when they want. 2023-03-14 20:00 Merged SciTE Release 5.3.5 with the SciTE4AutoIt3 sources Also show constant includes in #include<... dropdown. Fixed issue with portable directory duplicates due to improper case checking Fixed REGEX getting all possible *.au3 files when Dir returns a Timestamp in format hh:mm AM/PM How to test/install: Backup your current SciTE directory! Download the Beta SciTE4AutoIt3.exe installer or portable zip. Run installer or do your thing with the portable zip. Check below documentation on all possible configuration option via #Directive or in the SciTEUser.properties. Jos ============ Quick feature overview... check this Documentation for all details ======================================== This is how it looks with a basic example: Here I am using @Melba23's ExMsgBox include file which is located in my Private Include directory: This shown you in more details the basics of the changes: The announced change here has grown into a project on it own, which I feel is now at a stage where I could use some help from beta testers trying out these updated. I have created the initial documentation on all updates made and how the added functionality works, which is now part of the Helpfile available: AutoComplete & Dynamic Includes Previous Top Next Overview This LUA script functionality build in the SciTE4AutoIt3 version of SciTE will dynamically add #include statements required for the used UDFs or Global Const Variables. When dynamic.includes=1 you will be able to use Ctrl+Shift+z to process the whole file and scan it for missing Global Const Variables or UDFs. When dynamic.includes.whiletyping=1 is also set, the LUA functionality will add the required #include lines while typing. This only works when dynamic.includes=1. The AutoComplete functionality has also been changed and will now also search for partial matches in the names in stead of "Starting with", so you don't need to know the exact start of the funtion to be able to search for it. Changes to existing features Syntax Coloring All found Func's as defined here, not just the standard ones, will now immediately have their correct Font & formatting as defined for properties Styles 15-17. After you specified a none-standard known UDF, you will see it has Style 17 Color&Formatting when it is an UDF that exists in an Include file specifically for this Script. Selection for #include lines You can now use either < ' " as starting character to trigger the DropdownList with available include files. This list will now include all Standard, User defined and Dynamically found Include files. You can now type any part of the include name, not just the starting letters, to find the Include file you want. For example when you type: #include<apic this will be shown and we just press 2 times the Down key: .. then when you hit the Tab key, this will be the result: Smart AutoComplete function for Variables, Functions and Abbreviations The Dropdown will show al list of possible Variables or Functions and Abbreviation when you start typing. The match is done on the whole functionname now, not just the starting characters. The Starting $ or _ characters are ignored in this search and the results are shown in the order of the starting position in the found "words" of the typed characters: Example 1: When we type Find the below is returned: As you can see they are sorted in the order of starting position of "Find" and then Alphabetically Example 2: When you type $Yes, the result will be: New: How Dynamic #Include line insertion works Example1 When you type the following in your source: _ArrayAdd .. and then when you hit the Opening bracket or space key, the required #include<array.au3> line will be added within the existing or newly created #region: The same will happen when you use one of the Global Const variables from one of the *constants*.au3 includes in the defined include directories. This #region can be moved to any place in the script you prefer and will be used from here on as long as you do not change anything in those 2 #region lines. Any Subsequent added include file will be added to the end of the list with the Date&Time of the addition so you can easily see when/what was added. Example2 This is an Example for an new script in the SciTE_Jump Directory showing the use of the #SciTE4AutoIt3_Dynamic_Include_Path=; directive: The includes for this Utility are located in the Includes subdirectory, so aren't considered unless we specify it as follows: #SciTE4AutoIt3_Dynamic_Include_Path=;Includes; ... and then we start typing the name of one of the UDFs in a include in this directory and hit Tab on the first one shown: When we then hit the Opening bracket or Space key, the required #include"includes\_SciTE.au3" line will be added within the existing or newly created #region: Example3 This is an Example for a Global Const include file addition: We have just typed the last line of this script: .. and hit the Space key, the required #include<MsgBoxConstants.au3> line will be added within the existing #Region above the #EndRegion line: These are all the Func's (UDFs) that will be recognized by the dynamic include process: All Funcs in the default autoit/includes directory with format _ABC(), undocumented Funcs will be added to AutoComplete All Funcs except __*.au3 from all extra *.au3 Files in the openfile= paths that have a #include-once in it, are added to Style 16 (UserUDFs). All Funcs from the current script file are added to style 17 (InFIleUDFs) All Gobal Const Variables defined in any of the previous defined paths that are defined in a *constants*.au3 scriptfile which also includes #include-once. All Funcs except __*.au3 from all *.au3 Files in the current script directory are added to Style 16 (UserUDFs). All Funcs except __*.au3 from all *.au3 Files in the directories defined with Directive:#SciTE4AutoIt3_Dynamic_Include_Path=;Includes\relative\path;d;\includes\absolute\path Items 1-4 are read from those directories one time during the life of SciTE, but only when the first *.au3 files is opened. (slows it down ~0.5 sec one time to build all required tables) Items 5-6 are read each time an *au3 file is Opened or Switched to its Tab. (slows it down ~0.1 - 0.2 secs per change of tab and at Save time, to build all required current file tables) Configuration options for AutoComplete & Dynamic Includes This is the section in au3.properties where the autocomplete & dynamic includes config is defined. You can copy any of these lines into your SciTEUser.properties: ## ------------------------------------------------------------------------------------------------------------------------ ## dynamic.include Directives and properties reference ## ----------------------------------------------------- #SciTE4AutoIt3_Dynamic_Include=y ;dynamic.include=y/n #SciTE4AutoIt3_Dynamic_Include_whiletyping=y ;dynamic.include.whiletyping=y/n #SciTE4AutoIt3_Dynamic_Include_recursive_check=n ;dynamic.include.recursive.check=n/y #SciTE4AutoIt3_Dynamic_Include_use_local_cache=n ;dynamic.include.use.local.cache=n/y #SciTE4AutoIt3_Dynamic_Include_version=prod ;dynamic.include.version=prod/beta #SciTE4AutoIt3_Dynamic_Include_verboselevel=0 ;dynamic.include.verbose.level=0/1/2 #SciTE4AutoIt3_Dynamic_Include_Path= #SciTE4AutoIt3_AutoItDynamicIncludes_debug=n ;debug.autoitdynamicincludes=n/y #SciTE4AutoIt3_AutoItAutocomplete_debug=n ;debug.autoitautocomplet=n/y #SciTE4AutoIt3_AutoItGotoDefinition_debug=n ;debug.autoitgotodefinition=n/y #SciTE4AutoIt3_AutoItTools_debug=n ;debug.autoIttools=n/y ## ================================================ ## dynamic.include config ## ================================================ #> dynamic.include=y/n n=disabled y=will automatically build the func tables for coloring and autocomplete (requires restart SciTE!) dynamic.include=y #> whiletyping=y/n n=disabled y=will automatically add any required standard or USERincludefile for the current line, on the fly, when ) or enter ispressed !) dynamic.include.whiletyping=y #> use.local.cache=n/y n=disable y=Use cache file for local Include UDFs and VARs which could increase the speed when you have a lot of local includefiles which normally shouldn't be the case dynamic.include.use.local.cache=n #> version prod=Use AutoIt3 Production version beta=Use AutoIt3 Beta version dynamic.include.version=prod #> recursive.check=n/y n=disable y=When you like to only add an Include when it isn't included through another #included file yet. dynamic.include.recursive.check=n # level of debug messages 0/1/2 0=disabled; 1= Warnings & Timing per Function; 2=1+Total timing dynamic.include.verbose.level=0 #> Max number of includes files to read from the user directories in the list. This doesn't including the standard AutoIt3 includes. dynamic.max.includes=150 #> Max number total UDFs in the Userlist to handle by dynamic includes. This doesn't including the standard AutoIt3 includes-UDFs. dynamic.max.funcs=3000 #> Scriptlines longer that this value won't be looked at for Checking for required #Include statements. dynamic.max.line.length=300 ## ================================================ ## Autocomplete and call tip settings ## ================================================ autocomplete.au3.disable=0 autocomplete.au3.ignorecase=1 # Define minimum length before AutoComplete dropdown is shown- default=2 autocomplete.au3.min.length=2 # Include Abbrevs in AutoComplete dropdown (default=1/y) autocomplete.au3.include_abbrevs=1 # Don't show AutoItComplete with these styles (Internal only in SciTE4AutoIt3) autocomplete.ignore.styles.$(au3)=1;2;3;6;7;10;13 # Define which character will be added after Tab or Enter was entered and not on a Function/UDF: Can be \s \t \n for space;tab;newline autocomplete.au3.on.enter=\n autocomplete.au3.on.tab= # List of all AutoComplete API files used api.$(au3)=$(SciteDefaultHome)\api\au3.api;$(SciteDefaultHome)\api\au3.autoit3wrapper.api;$(SciteUserHome)\au3.std.dynamic.calltips.api;$(SciteUserHome)\au3.file.dynamic.calltips.api;$(SciteUserHome)\au3.usr.dynamic.calltips.api;$(SciteUserHome)\au3.user.calltips.api ## ================================================ ## Separate settings for debugging these Lua files ## ================================================ #> Enable debugging for these lua scripts: debug.autoitdynamicincludes=n debug.autoitautocomplete=n debug.autoitgotodefinition=n debug.autoitindentfix=n debug.autoittools=n #> when debug.tofile is defined, log records will be send to the log in stead of OutputPane: debug.tofile=$(SciteUserHome)\SciTE_LUA_Scripts_Debug.err # ------------------------------------------------------------------------------------------------------------------------
    1 point
  3. Zedna

    Barcode - UDF

    OPENBARCODES project http://grandzebu.net/index.php?page=/informatique/codbar-en/codbar.htm all is under GPL - GNU license , open source and completely free... I translated original Pascal functions to PowerBuilder syntax which is very similar to AutoIt (BARCODE_powerbuilder.zip). Now I translated all barcode functions to AutoIt syntax (barcode_autoit.zip). BarCode UDF + example --> you must install aproppriate TTF fonts into Windows first. barcode.au3 barcode_test.au3 print.au3 code128.ttf code25I.ttf code39.ttf ean13.ttf Available functions: barcode_128() barcode_ean8() barcode_ean13() barcode_25i() barcode_39() ; TTF fonts must be installed in system first #AutoIt3Wrapper_run_obfuscator=y #Obfuscator_parameters=/so #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <print.au3> #include <barcode.au3> $barcode_test = GUICreate("BarCode Test", 601, 174, -1, -1) GUICtrlCreateLabel("Input:", 11, 10, 30, 17) $Input = GUICtrlCreateInput("", 41, 8, 120, 21) GUICtrlCreateLabel("Output:", 171, 10, 38, 17) $Output = GUICtrlCreateInput("", 209, 8, 120, 21) GUICtrlSetState(-1, $GUI_DISABLE) $print = GUICtrlCreateButton("Print", 340, 7, 39, 23) GUICtrlCreateLabel("Type:", 387, 10, 28, 17) $type = GUICtrlCreateCombo("", 417, 8, 91, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Code 128|EAN 8|EAN 13|Code 2 of 5 i|Code 3 of 9", "Code 128") GUICtrlCreateLabel("Size:", 517, 10, 25, 17) $size = GUICtrlCreateCombo("", 543, 8, 47, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "12|18|24|36|48|60|72", "48") $barcode = GUICtrlCreateLabel("", 10, 39, 580, 130) GUICtrlSetFont(-1, 48, 400, 0, "Code 128") GUICtrlSetBkColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $type ChangeFont() ApplyBarcode() Case $size ChangeFont() Case $print Print() EndSwitch WEnd Func WM_COMMAND($hWinHandle, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $Input Then ApplyBarcode() EndIf EndFunc Func ChangeFont() Switch GUICtrlRead($type) Case 'Code 128' $font_name = 'Code 128' Case 'EAN 8','EAN 13' $font_name = 'Code EAN13' Case 'Code 2 of 5 i' $font_name = 'Code 2 of 5 interleaved' Case 'Code 3 of 9' $font_name = 'Code 3 de 9' EndSwitch GUICtrlSetFont($barcode, GUICtrlRead($size), 400, 0, $font_name) EndFunc Func ApplyBarcode() Switch GUICtrlRead($type) Case 'Code 128' $barcode_data = barcode_128(GUICtrlRead($Input)) Case 'EAN 8' $barcode_data = barcode_ean8(GUICtrlRead($Input)) Case 'EAN 13' $barcode_data = barcode_ean13(GUICtrlRead($Input)) Case 'Code 2 of 5 i' $barcode_data = barcode_25i(GUICtrlRead($Input)) Case 'Code 3 of 9' $barcode_data = barcode_39(GUICtrlRead($Input)) EndSwitch GUICtrlSetData($Output, $barcode_data) GUICtrlSetData($barcode, $barcode_data) EndFunc ; print given text on default printer in given size by all available barcode types Func Print() $sPrinter = _GetDefaultPrinter() If $sPrinter = "" Then Return $hPrintDC = _WinAPI_CreateDC("winspool", $sPrinter) _InitPrinter($hPrintDC, "Printing Barcodes from AutoIt") ; print job name $hFont = _CreateFont_Simple('Arial', 12, $FW_BOLD) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _TextOut_Centered($hPrintDC, 500, 'Input data: ' & GUICtrlRead($Input), 0xFF0000) _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) $hFont = _CreateFont_Simple('Courier', 10, $FW_NORMAL) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _WinAPI_SetTextColor($hPrintDC, 0x000000) _TextOut_Centered($hPrintDC, 1400, 'Code 128') _TextOut_Centered($hPrintDC, 2400, 'EAN 8') _TextOut_Centered($hPrintDC, 3400, 'EAN 13') _TextOut_Centered($hPrintDC, 4400, 'Code 2 of 5 i') _TextOut_Centered($hPrintDC, 5400, 'Code 3 of 9') _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) $hFont = _CreateFont_Simple('Code 128', GUICtrlRead($size), $FW_NORMAL) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _TextOut_Centered($hPrintDC, 1500, barcode_128(GUICtrlRead($Input))) _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) $hFont = _CreateFont_Simple('Code EAN13', GUICtrlRead($size), $FW_NORMAL) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _TextOut_Centered($hPrintDC, 2500, barcode_ean8(GUICtrlRead($Input))) _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) $hFont = _CreateFont_Simple('Code EAN13', GUICtrlRead($size), $FW_NORMAL) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _TextOut_Centered($hPrintDC, 3500, barcode_ean13(GUICtrlRead($Input))) _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) $hFont = _CreateFont_Simple('Code 2 of 5 interleaved', GUICtrlRead($size), $FW_NORMAL) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _TextOut_Centered($hPrintDC, 4500, barcode_25i(GUICtrlRead($Input))) _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) $hFont = _CreateFont_Simple('Code 3 de 9', GUICtrlRead($size), $FW_NORMAL) $hFontOld = _WinAPI_SelectObject($hPrintDC, $hFont) _TextOut_Centered($hPrintDC, 5500, barcode_39(GUICtrlRead($Input))) _WinAPI_SelectObject($hPrintDC, $hFontOld) _WinAPI_DeleteObject($hFont) _DeInitPrinter($hPrintDC) EndFunc History: 2012-06-01 - only Code 128 translated 2012-06-03 - all functions translated 2012-06-04 - added Print + some inner optimizations Original idea comes from this topic: Previous downloads (AutoIt): 31 BARCODE_powerbuilder.zip barcode_autoit.zip Printing Barcodes from AutoIt.pdf
    1 point
  4. As JLogan3o13 already said, by closing an application with WinClose() you give the opportunity for the application to process the close message as it wants. The application might have to release resources or maybe to close some files or other things, so it's generally a better way to close a window or by case an entire process. With WinClose() the application will have that chance but ProcessClose() will kill the process as it will be terminated from Task Manager.
    1 point
  5. I think you have answered your own question in the link. ProcessClose is an termination action; just like going into Task Manager and ending the process through the GUI. WinClose sends a close message to a window (similar to clicking the x). It is not so forceful as WinKill or ProcessClose, as you will be prompted if there is data to save. So, as to the "preferred" option, like most questions, it depends on what you're trying to accomplish.
    1 point
  6. Andreik

    Hold RMB

    Using some pauses as Jos suggested would fix your CPU usage. #include <Misc.au3> $status = 0 Local $hDLL = DllOpen("user32.dll") Func status () if _IsPressed("02",$hDLL) = true then $status -= 1 Do _IsPressed("02",$hDLL) Sleep(10) until Not _IsPressed("02", $hDLL) $status += 2 If $status = 3 Then $status = 1 EndIf EndFunc While True status () if $status = 1 Then ;ConsoleWrite("_IsPressed - Click_1." & @CRLF) ;Для отладки Send("{n down}") Do status () Sleep(10) until $status = 2 ElseIf $status = 2 Then ;ConsoleWrite("_IsPressed - Click_2." & @CRLF) ;Для отладки Send("{n up}") Do status() Sleep(10) until $status = 1 EndIf sleep(30) WEnd DllClose($hDLL)
    1 point
  7. #AutoIt3Wrapper_UseX64=y ConsoleWrite(@SystemDir & @CRLF) Run("C:\Windows\system32\WFS.exe") $hWnd = WinWait("Windows Fax and Scan", "", 3) ConsoleWrite("$hWnd=" & $hWnd & @CRLF) If $hWnd Then WinActivate($hWnd) ; With ControlCommand ControlCommand($hWnd, "", "ToolbarWindow322", "SendCommandID", 177) ;from Au3Info ToolBar tab ;~ ; With send ;~ Send("!fns") ;Alt f n s ;~ ; With Menu ;~ WinMenuSelectItem($hWnd, "", "&File", "&New", "&Scan") EndIf
    1 point
  8. It's not just moving the selection. If you look at his examples he want to be able to mark certain columns, for example just 2 columns out of 3. This behavior it's not default to list views.
    1 point
  9. Is already done but part of the AutoIt3 installer. I have copied the updated AutoIt3Help.exe to the Beta dir for Dynamic stuff, so you can already use it.
    1 point
  10. Jos

    MailSlot

    Haha ... feeling a noob here being directed to the Wiki to RTFM.
    1 point
  11. willichan

    Barcode Generators

    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. Code128Auto - Creates a Code128A/B/C optimized barcode from supplied data Code39 - Creates 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.
    1 point
  12. willichan

    Barcode Generators

    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
    1 point
  13. I like the script too. In case it's of any help here is a very simple example script to print the barcode after it has been generated. I added a function to andybiochem's script and added an include. To use it you need to get my print UDF and dll from my signature. ;Code 128 Barcode Generator - Andy M 2008 (andybiochem) #include <array.au3> #include <file.au3> #include 'printMGv2.au3';<---------added my martin Opt("GUIOnEventMode", 1) ;************************************************************************************* ; Declare Vars ;************************************************************************************* Global $array[104] Global $CodeArray Global $data Global $L[1] ;************************************************************************************* ; Assign Code 128 Pattern array ;************************************************************************************* ; Items are "[Value]¬[Bcode]¬[Ccode]¬[1/0 Pattern]" $array[1] = "0¬ ¬00¬11011001100" $array[2] = "1¬!¬01¬11001101100" $array[3] = '2¬"¬02¬11001100110' $array[4] = "3¬#¬03¬10010011000" $array[5] = "4¬$¬04¬10010001100" $array[6] = "5¬%¬05¬10001001100" $array[7] = "6¬&¬06¬10011001000" $array[8] = "7¬'¬07¬10011000100" $array[9] = "8¬(¬08¬10001100100" $array[10] = "9¬)¬09¬11001001000" $array[11] = "10¬*¬10¬11001000100" $array[12] = "11¬+¬11¬11000100100" $array[13] = "12¬,¬12¬10110011100" $array[14] = "13¬-¬13¬10011011100" $array[15] = "14¬.¬14¬10011001110" $array[16] = "15¬/¬15¬10111001100" $array[17] = "16¬0¬16¬10011101100" $array[18] = "17¬1¬17¬10011100110" $array[19] = "18¬2¬18¬11001110010" $array[20] = "19¬3¬19¬11001011100" $array[21] = "20¬4¬20¬11001001110" $array[22] = "21¬5¬21¬11011100100" $array[23] = "22¬6¬22¬11001110100" $array[24] = "23¬7¬23¬11101101110" $array[25] = "24¬8¬24¬11101001100" $array[26] = "25¬9¬25¬11100101100" $array[27] = "26¬:¬26¬11100100110" $array[28] = "27¬;¬27¬11101100100" $array[29] = "28¬<¬28¬11100110100" $array[30] = "29¬=¬29¬11100110010" $array[31] = "30¬>¬30¬11011011000" $array[32] = "31¬?¬31¬11011000110" $array[33] = "32¬@¬32¬11000110110" $array[34] = "33¬A¬33¬10100011000" $array[35] = "34¬B¬34¬10001011000" $array[36] = "35¬C¬35¬10001000110" $array[37] = "36¬D¬36¬10110001000" $array[38] = "37¬E¬37¬10001101000" $array[39] = "38¬F¬38¬10001100010" $array[40] = "39¬G¬39¬11010001000" $array[41] = "40¬H¬40¬11000101000" $array[42] = "41¬I¬41¬11000100010" $array[43] = "42¬J¬42¬10110111000" $array[44] = "43¬K¬43¬10110001110" $array[45] = "44¬L¬44¬10001101110" $array[46] = "45¬M¬45¬10111011000" $array[47] = "46¬N¬46¬10111000110" $array[48] = "47¬O¬47¬10001110110" $array[49] = "48¬P¬48¬11101110110" $array[50] = "49¬Q¬49¬11010001110" $array[51] = "50¬R¬50¬11000101110" $array[52] = "51¬S¬51¬11011101000" $array[53] = "52¬T¬52¬11011100010" $array[54] = "53¬U¬53¬11011101110" $array[55] = "54¬V¬54¬11101011000" $array[56] = "55¬W¬55¬11101000110" $array[57] = "56¬X¬56¬11100010110" $array[58] = "57¬Y¬57¬11101101000" $array[59] = "58¬Z¬58¬11101100010" $array[60] = "59¬[¬59¬11100011010" $array[61] = "60¬\¬60¬11101111010" $array[62] = "61¬]¬61¬11001000010" $array[63] = "62¬^¬62¬11110001010" $array[64] = "63¬_¬63¬10100110000" $array[65] = "64¬`¬64¬10100001100" $array[66] = "65¬a¬65¬10010110000" $array[67] = "66¬b¬66¬10010000110" $array[68] = "67¬c¬67¬10000101100" $array[69] = "68¬d¬68¬10000100110" $array[70] = "69¬e¬69¬10110010000" $array[71] = "70¬f¬70¬10110000100" $array[72] = "71¬g¬71¬10011010000" $array[73] = "72¬h¬72¬10011000010" $array[74] = "73¬i¬73¬10000110100" $array[75] = "74¬j¬74¬10000110010" $array[76] = "75¬k¬75¬11000010010" $array[77] = "76¬l¬76¬11001010000" $array[78] = "77¬m¬77¬11110111010" $array[79] = "78¬n¬78¬11000010100" $array[80] = "79¬o¬79¬10001111010" $array[81] = "80¬p¬80¬10100111100" $array[82] = "81¬q¬81¬10010111100" $array[83] = "82¬r¬82¬10010011110" $array[84] = "83¬s¬83¬10111100100" $array[85] = "84¬t¬84¬10011110100" $array[86] = "85¬u¬85¬10011110010" $array[87] = "86¬v¬86¬11110100100" $array[88] = "87¬w¬87¬11110010100" $array[89] = "88¬x¬88¬11110010010" $array[90] = "89¬y¬89¬11011011110" $array[91] = "90¬z¬90¬11011110110" $array[92] = "91¬{¬91¬11110110110" $array[93] = "92¬|¬92¬10101111000" $array[94] = "93¬}¬93¬10100011110" $array[95] = "94¬~¬94¬10001011110" $array[96] = "95¬del¬95¬10111101000" $array[97] = "96¬Fnc3¬96¬10111100010" $array[98] = "97¬Fnc2¬97¬11110101000" $array[99] = "98¬Shift¬98¬11110100010" $array[100] = "99¬Code C¬99¬10111011110" $array[101] = "100¬Fnc 4¬Code B¬10111101110" $array[102] = "101¬Code A¬Code A¬11101011110" $array[103] = "102¬Fnc 1¬Fnc 1¬11110101110" ;************************************************************************************* ; GUI ;************************************************************************************* GUICreate("Code 128 (B/C) Barcode Generator - AndyBiochem 2008", 613, 286) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $Input = GUICtrlCreateInput("", 8, 8, 321, 25) GUICtrlSetFont(-1,12) GUICtrlCreateButton("Generate Barcode", 344, 8, 257, 25) GUICtrlSetOnEvent(-1,"MakeBarcode") GUICtrlCreateLabel("", 8, 48, 596, 225) GUICtrlSetBkColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) ;##################################################################################### ; LOOP ;##################################################################################### While 1 Sleep(100) WEnd ;##################################################################################### ; END LOOP ;##################################################################################### Func MakeBarcode() ;************************************************************************************* ; Delete previous barcode ;************************************************************************************* for $i = 1 to (UBound($L) - 1) GUICtrlDelete($L[$i]) Next ;************************************************************************************* ; Generate Pattern ;************************************************************************************* $Barcode = IdentifyCodeSwitches(GUICtrlRead($Input)) ;************************************************************************************* ; Draw new Barcode ;************************************************************************************* Dim $L[StringLen($Barcode) + 1] $i = 1 While $i <= StringLen($barcode) $col = StringMid($barcode,$i,1) if $col = 1 Then $L[$i] = GUICtrlCreateLabel("",50 + ($i * 2),100,2,100) GUICtrlSetBkColor(-1,0x000000) Else $L[$i] = GUICtrlCreateLabel("",50 + ($i * 2),100,2,100) GUICtrlSetBkColor(-1,0xFFFFFF) EndIf $i += 1 WEnd printBarCode(GUICtrlRead($Input), $Barcode) EndFunc Func IdentifyCodeSwitches($code) ;************************************************************************************* ; Identify where code switches should be ;************************************************************************************* $i = 1 $CodeType = "B" ;always start with code type B $len = StringLen($Code) While $i <= $len Select Case $CodeType = "B" if StringRegExp(StringMid($Code,$i,6),"([0-9][0-9]){3}") = 1 Then $Code = StringMid($Code,1,$i - 1) & "¬C¬" & StringMid($Code,$i) $CodeType = "C" $i += 6 + 3 Else $CodeType = "B" $i += 1 EndIf Case $CodeType = "C" if StringRegExp(StringMid($Code,$i,2),"([0-9][0-9])") <> 1 Then $Code = StringMid($Code,1,$i - 1) & "¬B¬" & StringMid($Code,$i) $CodeType = "B" $i += 2 + 3 Else $CodeType = "C" $i += 2 EndIf EndSelect $len = StringLen($Code) WEnd ;************************************************************************************* ; Add start code B, if not already started C ;************************************************************************************* if StringMid($Code,1,3) <> "¬C¬" then $Code = "¬B¬" & $Code ;************************************************************************************* ; Split to array, re-assemble code switches ;************************************************************************************* $CodeArray = StringSplit($code,"") for $i = 1 to (UBound($CodeArray) - 3) Select case $CodeArray[$i] & $CodeArray[$i+1] & $CodeArray[$i+2] = "¬B¬" $CodeArray[$i] = "[B]" $CodeArray[$i+1] = "" $CodeArray[$i+2] = "" case $CodeArray[$i] & $CodeArray[$i+1] & $CodeArray[$i+2] = "¬C¬" $CodeArray[$i] = "[C]" $CodeArray[$i+1] = "" $CodeArray[$i+2] = "" EndSelect Next ;************************************************************************************* ; Remove empty items ;************************************************************************************* for $i = (UBound($CodeArray) - 1) to 1 step -1 if $CodeArray[$i] = "" then _ArrayDelete($CodeArray,$i) Next ;************************************************************************************* ; Concatenate C number pairs ;************************************************************************************* $i = 1 While $i <= (UBound($CodeArray) - 1) if $CodeArray[$i] = "[C]" Then $i += 1 do if $CodeArray[$i] = "" then $i += 1 Else $CodeArray[$i] &= $CodeArray[$i + 1] $CodeArray[$i + 1] = "" $i += 1 EndIf Until $i = (UBound($CodeArray) - 1) Or $CodeArray[$i] = "[B]" or $CodeArray[$i + 1] = "[B]" EndIf $i += 1 WEnd ;************************************************************************************* ; Remove empty items ;************************************************************************************* for $i = (UBound($CodeArray) - 1) to 1 step -1 if $CodeArray[$i] = "" then _ArrayDelete($CodeArray,$i) Next ;************************************************************************************* ; Replace Items with 128 Code Patterns, and mount checksum ;************************************************************************************* _ArrayDelete($CodeArray,0) ;important If $CodeArray[0] = "[B]" Then $CodeArray[0] = "11010010000" $SUM = 104 $CodeType = "[B]" Else $CodeArray[0] = "11010011100" $SUM = 105 $CodeType = "[C]" EndIf for $i = 1 to (UBound($CodeArray) - 1) if $CodeArray[$i] = "[B]" Then $CodeArray[$i] = "10111101110" $SUM += $i * 100 $CodeType = "[B]" ContinueLoop EndIf if $CodeArray[$i] = "[C]" Then $CodeArray[$i] = "10111011110" $SUM += $i * 99 $CodeType = "[C]" ContinueLoop EndIf for $j = 1 to (UBound($array) - 1) $data = StringSplit($array[$j],"¬") Select case $CodeType = "[B]" if $CodeArray[$i] == $data[2] Then $CodeArray[$i] = $data[4] $SUM += $i * $data[1] EndIf case $CodeType = "[C]" if $CodeArray[$i] == $data[3] Then $CodeArray[$i] = $data[4] $SUM += $i * $data[1] EndIf EndSelect Next Next ;************************************************************************************* ; Calculate & find checksum item ;************************************************************************************* $ChecksumItem = Mod($SUM,103) $data = StringSplit($array[$ChecksumItem + 1],"¬") _ArrayAdd($CodeArray,$data[4]) ;************************************************************************************* ; Add stop item ;************************************************************************************* _ArrayAdd($CodeArray,"1100011101011") ;************************************************************************************* ; Flatten array ;************************************************************************************* $CodeArrayString = _ArrayToString($CodeArray,"") Return $CodeArrayString EndFunc func close() ;************************************************************************************* ; Bye bye ;************************************************************************************* Exit EndFunc Func PrintBarCode($bctext,$bcode);<-------------added by martin Local $hp, $mmssgg Local $barSpacing = 5;0.5 mm - i don't know what is normal Local $barHt = 200;20mm Local $xstart = 100, $ystart = 300;offsets to start of print $hp = _PrintDllStart($mmssgg);this must always be called first If $hp = 0 Then MsgBox(262144,"ERROR","Error from dllstart = " & $mmssgg & @CRLF) Return EndIf _PrintGetPrinter($hp);choose the printer if you don't want the default printer $newselect = _PrintSetPrinter($hp);see also _PrintSelectPrinter ;MsgBox(0, 'reseult from set printer = ', _PrintGetPrinter($hp));choose the printer if you don't want the default printer _PrintPageOrientation($hp, 1);portrait _PrintStartPrint($hp) _PrintSetLineWid($hp,$barSpacing) _PrintSetLineCol($hp, 0);set line col to black $i = 1 While $i <= StringLen($bcode) If StringMid($bcode, $i, 1) = '1' Then _PrintLine($hp, $xstart + $i * $barSpacing, $ystart, $xstart + $i * $barSpacing, $ystart + $barHt) EndIf $i += 1 WEnd ;quickest way I could think of to neaten up the ragged line ends _PrintSetLineCol($hp, 0xffffff);set line col to white _PrintLine($hp, $xstart , $ystart, $xstart + $i * $barSpacing, $ystart) _PrintLine($hp, $xstart , $ystart + $barHt, $xstart + $i * $barSpacing, $ystart + $barHt) _PrintSetFont($hp, 'Arial', 18, 0, 'bold') _PrintText($hp,$bctext,$xstart,$ystart + $barHt + _PrintGetTextHeight($hp,"{") + 5) _PrintEndPrint($hp) _PrintNewPage($hp);not really needed since only one page used _printDllClose($hp) EndFunc
    1 point
×
×
  • Create New...