Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/01/2018 in all areas

  1. 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
  2. Bowmore

    Random Click

    I think you would benefit from reading and watching some of the tutorials here https://www.autoitscript.com/wiki/Tutorials as you seem to lack some understanding of the basics required for programming with AutoIt. To get your script to work you need to change you script to something like this. MouseClick("left",1061,618) sleep(1901) ClickRandomly() sleep(1901) Send("{ENTER}") sleep(1901) ClickRandomly() sleep(1901) Send("{ENTER}") sleep(1901) ClickRandomly() sleep(1901) Func ClickRandomly() Local $RandomNumber = Random(1,9,1) If $RandomNumber == 1 Then MouseClick("Left",592,173) EndIF If $RandomNumber == 2 Then MouseClick("Left",309,631) EndIF If $RandomNumber == 3 Then MouseClick("Left",350,691) EndIF If $RandomNumber == 4 Then MouseClick("Left",630,731) EndIF If $RandomNumber == 5 Then MouseClick("Left",1005,31) EndIF If $RandomNumber == 6 Then MouseClick("Left",1005,31) EndIF If $RandomNumber == 7 Then MouseClick("Left",1035,101) EndIF If $RandomNumber == 8 Then MouseClick("Left",1505,91) EndIF If $RandomNumber == 9 Then MouseClick("Left",1995,331) EndIf EndFunc
    1 point
  3. Melba23

    Random Click

    iepurasul, You do not add the required random numbers as parameters - you let the function determine those. As explained in the Help file (you even linked to the page) all you need is the minimum and maximum values you want (and in your case setting the flag because you want integers): Random(1, 10, 1) Now you will get an integer from 1 to 10 each time you call the function. M23
    1 point
  4. Excellent, well done! Glad it worked out (and fast too).
    1 point
  5. There's always a workaround: #include <IE.au3> $oIE = _IECreate() Local $sHTML = '<html><body><img src="http://aut1.autoit-cdn.com/site/wp-content/themes/TheCorporation/images/logo@2x.png" width="210"height="72" alt="AutoItScript" id="logo" /></body></html>' _IEBodyWriteHTML($oIE, $sHTML) Local $AllImages = _IETagNameGetCollection($oIE, 'img') For $OneImage in $AllImages If $OneImage.id = 'logo' Then If $OneImage.getAttribute("style") = '' Then MsgBox(0, '', 'about to change') $OneImage.outerhtml = StringTrimRight($OneImage.outerhtml, 1) & ' style="border:5px solid green;">' MsgBox(0, '', 'after changing') Else MsgBox(0, '', 'about to change') $OneImage.setAttribute("style") = "border:5px solid green;" MsgBox(0, '', 'after changing') EndIf ExitLoop EndIf Next
    1 point
  6. Hello friends, my application when it ends returns me Exit Code: -1073740771 can you tell me what it means? thank you so much
    0 points
  7. Just looking for something quick and easy. Don't need over complicated things for this project.
    0 points
×
×
  • Create New...