Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/21/2022 in all areas

  1. Other options (already described many times) are : 1. use the .a3x-Format : see e.g. : are-my-autoit-exes-really-infected 2. solution from @Exit : see : au3tocmd-avoid-false-positives 3. Compile your script as a 64-bit application : #AutoIt3Wrapper_UseX64 = Y Some users have reported, that this may solve issues with AV scanners.
    2 points
  2. Don't ask...Just try and see for yourself. 😉
    1 point
  3. Basically you just put two controls next to each other and color one, one color and another something else. I was writing a question about this on HOW to do this and in the process I figured it out. Since I wrote most of it already I just finished it into a little tutorial for those not already in the know on this. I am sure I will forget this and will need at sometime to rediscover so this is also a tutorial for my future self when I forget. There used to be a tutorial or scripts section in the forums, I am not able to find it or would put it there instead of here. Since it is GUI related I posted to the GUI Help and Support section.
    1 point
  4. Full Code Sample #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. HotKeySet("{ESC}", "close") Example() Func Example() Global $hGui = GUICreate("Example", 200, 120, -1, -1) GUISetState(@SW_SHOW, $hGui) #Region ;~ Vertical Separator GUICtrlCreateLabel("", 30, 20, 1, 90) ; L T W H GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", 31, 20, 1, 90) ; L T W H GUICtrlSetBKColor(-1, 0xFFFFFF) #EndRegion #Region ;~ Horizontal Separator GUICtrlCreateLabel("", 32, 40, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", 32, 41, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xFFFFFF) #EndRegion GUICtrlCreateLabel("Separator Lines Example", 32, 55, 150, 20, $SS_CENTER) ; L T W H Style StyleEX #Region ;~ Horizontal Separator GUICtrlCreateLabel("", 32, 81, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", 32, 82, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xFFFFFF) #EndRegion #Region ;~ Tray Menu TrayCreateItem("") ; Create a separator line. TrayCreateItem("Separator Lines Example") TrayCreateItem("") ; Create a separator line. #EndRegion Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE close() EndSwitch Switch TrayGetMsg() Case $idExit ; Exit the loop. close() EndSwitch WEnd EndFunc ;==>Example Func close() GUIDelete($hGui) Exit EndFunc
    1 point
  5. Not sure what you are waiting for, but there is an update available since: Yes you can as SciTE4AutoIt3 is independent of the AutoIt3 version, the only thing that needs to be correct are the properties files that came with the latest version of AutoIt3. I currently have an SciTE v 5.2.3 Test version available for the MVP, whom are extensively testing it and supplying me with loads of feedback. This version will include some major lua functionality changes too for AutoComplete and Automatically add required Include files while typing. Jos
    1 point
  6. Probably due to your AV software. Are you running anything besides Windows Defender?
    1 point
  7. Here's a complete rewriten version of Text2PDF example, with explanations: #include "..\MPDF_UDF.au3" ;<<<< modify the path to the MPDF_UDF #include <File.au3> #include <Misc.au3> Global $sF = FileOpenDialog("Choose a text file", @ScriptDir & "\", "Text file (*.au3;*.txt;*.ini;*cfg;*.*)", 1) If @error Then MsgBox(4096, "", "No File chosen") Else $iStart = TimerInit() ;set the properties for the pdf _SetTitle("Txt2PDF") _SetSubject("Convert text file to pdf") _SetKeywords("pdf, AutoIt") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("A4") _SetZoomMode($PDF_ZOOM_CUSTOM, 90) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\Txt2Pdf.pdf") _LoadFontTT("F1", $PDF_FONT_CALIBRI, $PDF_FONT_ITALIC) _Txt2PDF($sF, "F1") ;write the buffer to disk _ClosePDFFile() __Test("!Done in "&Round(TimerDiff($iStart)/1000,3)&" sec.") EndIf ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Txt2PDF ; Description ...: Convert a text file to pdf ; Syntax ........: _Txt2PDF( $sText , $sFontAlias , [$iTextHeight=""] ) ; Parameters ....: $sText - file path. ; $sFontAlias - font alias. ; $iTextHeight - font size. ; Return values .: None ; Author(s) .....: Mihai Iancu (taietel at yahoo dot com) ; Modified ......: August 11, 2011 ; Remarks .......: If the string is very long, it will be scaled to paper width ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _Txt2PDF($sFile, $sFontAlias, $iTextHeight="") Dim $iTotalRows ;get the rows of the text _FileReadToArray($sFile, $iTotalRows) ;check the text height If $iTextHeight="" Then $iTextHeight = 10 ;get the unit used Local $iUnit = _GetUnit() ;set the left margin of the page Local $iX = 2 ;set the top margin Local $iY = Round(_GetPageHeight() / $iUnit - 2) ;get the canvas width Local $iWidth = Round(_GetPageWidth() / $iUnit - 2 * $iX) ;initialize the scale factor and the counter Local $lScale, $counter = 1 ;set text row height Local $iRowHeight = 0.05 * $iTextHeight ;number of rows per page Local $iRowsPerPage = Floor(($iY -2)/ $iRowHeight) ;get the total pages Local $iTotalPages = Ceiling($iTotalRows[0] / $iRowsPerPage) ;initialize page number Local $iPgNumber For $j = 1 To $iTotalPages ;begin a new page $iPgNumber = _BeginPage() For $i = 1 To _Iif($iRowsPerPage < $iTotalRows[0], $iRowsPerPage, $iTotalRows[0]) ;start the counter If $counter <= $iTotalRows[0] Then ;get the lenght of the current row Local $iRowLength = Round(_GetTextLength($iTotalRows[$counter], $sFontAlias, $iTextHeight)) ;scale it if it is wider than the canvas width If $iRowLength > $iWidth Then $lScale = Ceiling($iWidth * 100 / $iRowLength) _SetTextHorizontalScaling($lScale) _DrawText($iX, $iY - $i * $iRowHeight, $iTotalRows[$counter], $sFontAlias, $iTextHeight, $PDF_ALIGN_LEFT, 0) _SetTextHorizontalScaling(100) Else ;if not, write it as it is _DrawText($iX, $iY - $i * $iRowHeight, $iTotalRows[$counter], $sFontAlias, $iTextHeight, $PDF_ALIGN_LEFT, 0) EndIf $counter += 1 EndIf Next ;write the page number _DrawText(_GetPageWidth() / _GetUnit() - 1, 1, $iPgNumber, "F1", $iTextHeight, $PDF_ALIGN_CENTER) ;and end the page _EndPage() Next EndFunc ;==>_Txt2PDF [EDIT] And here is an example of ListView to PDF: #include "..\MPDF_UDF.au3" ;modify the path to MPDF_UDF #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> _LV_Interface() Func _LV_Interface() Local $nMsg Local $hMainGUI = GUICreate("Example ListView2PDF", 600, 400) ;a listview with 10 columns and 30 rows Local $hLV = GUICtrlCreateListView("Col0|Col1|Col2|Col3|Col4|Col5|Col6|Col7|Col8|Col9", 5, 5, 590, 340, -1, $LVS_EX_GRIDLINES) For $i = 1 To 9 _GUICtrlListView_JustifyColumn(GUICtrlGetHandle($hLV), $i, 2) Next Local $hExpPDF = GUICtrlCreateButton("LV2PDF", 400, 360, 100, 30) GUISetState(@SW_SHOW) ;this is just for test Local $aItems[30][10] For $i = 0 To UBound($aItems) - 1 For $j = 0 To 9 $aItems[$i][$j] = Random(100, 1000) Next Next $iTimer = TimerInit() _GUICtrlListView_AddArray($hLV, $aItems) For $i = 0 To 9 _GUICtrlListView_SetColumnWidth($hLV, $i, $LVSCW_AUTOSIZE_USEHEADER) Next While 1 Sleep(10) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hExpPDF _LV2PDF($hLV) EndSwitch WEnd EndFunc ;==>_LV_Interface Func _LV2PDF($hLV, $sPDF = "") If $sPDF = "" Then $sPDF = @ScriptDir & "\Example_ListView2PDF.pdf" Local $aArray = _LV2Array($hLV) ;set the properties for the pdf _SetTitle("Demo LV2PDF PDF in AutoIt") _SetSubject("Demo LV2PDF PDF in AutoIt, with formating") _SetKeywords("pdf, demo, table, AutoIt") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("CUSTOM", 842, 595.3); A4 landscape _SetZoomMode($PDF_ZOOM_FULLPAGE) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF($sPDF) ;=== load used font(s) === _LoadFontTT("_CalibriI", $PDF_FONT_CALIBRI, $PDF_FONT_ITALIC) _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) ;begin page _BeginPage() _InsertLVTable($aArray, 2, 2) ;2cm from the bottom-left, width/height auto $sTitle = "Sample ListView2PDF generated with AutoIt" _SetTextRenderingMode(1) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTitle, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0x996600, 0x441100) _SetTextRenderingMode(0) _EndPage() ;write the buffer to disk _ClosePDFFile() EndFunc ;==>_LV2PDF Func _InsertLVTable($aArray, $iX, $iY, $iW = 0, $iH = 0, $lTxtColor = 0x000000, $lBorderColor = 0x888888) Local $iPgW = Round(_GetPageWidth() / _GetUnit(), 1) Local $iPgH = Round(_GetPageHeight() / _GetUnit(), 1) If $iW = 0 Then $iW = $iPgW - $iX - 2 If $iH = 0 Then $iH = $iPgH - $iY - 2 _SetColourStroke($lBorderColor) _Draw_Rectangle($iX, $iY, $iW, $iH, $PDF_STYLE_STROKED, 0, $lBorderColor, 0.1) _SetColourStroke(0) $iRows = UBound($aArray) $iCols = UBound($aArray, 2) Local $iColW = $iW / $iCols Local $iRowH = $iH / $iRows Local $lRGB For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 If $i = 0 Then $lRGB = 0xefefef Else $lRGB = 0xfefefe EndIf _SetColourStroke($lBorderColor) _Draw_Rectangle($iX + $j * $iColW, $iY + $iH - ($i + 1) * $iRowH, $iColW, $iRowH, $PDF_STYLE_STROKED, 0, $lRGB, 0.01) _SetColourStroke(0) Local $sText = $aArray[$i][$j] Local $sLength = Round(_GetTextLength($sText, "_Calibri", 10), 1) $lScale = Ceiling(0.75 * $iColW * 100 / $sLength) _SetColourFill($lTxtColor) _SetTextHorizontalScaling($lScale) _DrawText($iX + $j * $iColW + $iColW / 10, $iY + $iH - ($i + 1) * $iRowH + ($iRowH - 10 / _GetUnit()) / 2, $sText, "_Calibri", 10, $PDF_ALIGN_LEFT, 0) _SetTextHorizontalScaling(100) _SetColourFill(0) Next Next EndFunc ;==>_InsertLVTable Func _LV2Array($hLV) Local $iRows, $iCols $iRows = _GUICtrlListView_GetItemCount($hLV) $iCols = _GUICtrlListView_GetColumnCount($hLV) Local $aArray[$iRows][$iCols] For $i = 0 To $iRows - 1 Local $aItem = _GUICtrlListView_GetItemTextArray($hLV, $i) For $j = 1 To $aItem[0] $aArray[$i][$j - 1] = $aItem[$j] Next Next Return $aArray EndFunc ;==>_LV2Array
    1 point
×
×
  • Create New...