Leaderboard
Popular Content
Showing content with the highest reputation on 01/16/2025 in all areas
-
Well giving your full script with missing parts is not helping us very much. But since I am waiting for my car to get maintenance, here my take on what I think you want : #include <File.au3> #include <GUIConstants.au3> #include <InetConstants.au3> #include <GuiListView.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $aDownList[20][6] Local $hGUI = GUICreate('Example', 600, 600, 200, 200, $WS_SIZEBOX) Local $idListView = GUICtrlCreateListView("ID|Status|File", 50, 20, 500, 400) _GUICtrlListView_SetColumnWidth($idListView, 1, 80) _GUICtrlListView_SetColumnWidth($idListView, 2, 300) Local $idDownload = GUICtrlCreateButton("Add DownLoad", 50, 500, 150, 25) GUISetState() Local $iIndex While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idDownload ;$iIndex = AddDown($aDownList, "http://www.autoitscript.com/autoit3/files/beta/update.dat", _TempFile(@ScriptDir, Default, ".txt", 10)) $iIndex = AddDown($aDownList, "https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.zip", _TempFile(@ScriptDir, Default, ".zip", 10)) $aDownList[$iIndex][5] = GUICtrlCreateListViewItem($aDownList[$iIndex][0] & "|0.0%|" & $aDownList[$iIndex][3], $idListView) EndSwitch VerifyDownLoad($idListView, $aDownList) WEnd EndFunc ;==>Example Func AddDown(ByRef $aList, $sURL, $sFile) For $i = 0 To UBound($aList) - 1 If Not $aList[$i][0] Then ExitLoop Next If $i = UBound($aList) Then Return SetError(1) $aList[$i][0] = InetGet($sURL, $sFile, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) $aList[$i][1] = 0 $aList[$i][2] = 0 $aList[$i][3] = $sFile $aList[$i][4] = $sURL Return $i EndFunc ;==>AddDown Func VerifyDownLoad($idLV, ByRef $aList) Local $sStatus, $iValue Local $tInfo = DllStructCreate($tagLVFINDINFO) $tInfo.Flags = $LVFI_PARAM For $i = 0 To UBound($aList) - 1 If Not $aList[$i][0] Then ContinueLoop If InetGetInfo($aList[$i][0], $INET_DOWNLOADCOMPLETE) Then $sStatus = "Complete" InetClose($aList[$i][0]) $aList[$i][0] = 0 Else $iValue = InetGetInfo($aList[$i][0], $INET_DOWNLOADREAD) If $iValue = $aList[$i][2] Then ContinueLoop If Not $aList[$i][1] Then $aList[$i][1] = InetGetInfo($aList[$i][0], $INET_DOWNLOADSIZE) $sStatus = StringFormat("%.1f%%", $iValue / $aList[$i][1] * 100) $aList[$i][2] = $iValue EndIf $tInfo.Param = $aList[$i][5] $iValue = _GUICtrlListView_FindItem($idLV, -1, $tInfo) _GUICtrlListView_SetItem($idLV, $sStatus, $iValue, 1) Next EndFunc ;==>VerifyDownLoad ps. see how you can make a runable script without having the full blown code...1 point
-
@Gianni Added this UDF to the wiki1 point
-
GDIPlus approach for Colorful Rectangle Buttons with rounded corners from https://www.autoitscript.com/forum/topic/212626-how-to-create-rounded-corners-_gdiplus/ #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> Global $hGraphic, $hBrush, $hBrushFont, $hFont, $hFormat, $hFamily, $hGUI, $tRect_Coords[4] Global $iTheme = 0 Example() ;--------------------------------------------------------------------------------------- Func Example() ; Create GUI $hGUI = GUICreate("GDI+ Centered Text", 400, 300) ; Initialize GDI+ _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; antialiasing $hBrush = _GDIPlus_BrushCreateSolid(0xAA43A6DF) ; Blue $hBrushFont = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ; White $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) ; Horizontal alignment _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ; Vertical alignment $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI Light") $hFont = _GDIPlus_FontCreate($hFamily, 20, 2) ; Rectangle coordinates $tRect_Coords[0] = 50 $tRect_Coords[1] = 50 $tRect_Coords[2] = 200 $tRect_Coords[3] = 100 ; Register for painting GUIRegisterMsg($WM_PAINT, "WM_PAINT") GUISetState() ; Loop until the user exits Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN If CheckPointer($tRect_Coords) Then SetTheme(1) Case $GUI_EVENT_PRIMARYUP SetTheme(0) Case $GUI_EVENT_MOUSEMOVE If GetTheme() = 1 Then ContinueLoop If CheckPointer($tRect_Coords) Then SetTheme(2) Else SetTheme(0) EndIf EndSwitch Until 0 ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrushFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example ;--------------------------------------------------------------------------------------- Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) ; Clear the canvas _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0) ; Create a path for the rounded rectangle Local $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddRoundRect($hPath, $tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3], 50) ;~ _GDIPlus_PathAddRoundRect($hPath, $tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3], 20) ; Fill the rounded rectangle _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Optionally draw the outline Local $hPen = _GDIPlus_PenCreate(0xFF3685B2, 2) ; Darker Blue border _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ; Draw the string centered in the rectangle _GDIPlus_GraphicsDrawStringEx($hGraphic, "Click Me", $hFont, _GDIPlus_RectFCreate($tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3]), $hFormat, $hBrushFont) ; Clean up _GDIPlus_PenDispose($hPen) _GDIPlus_PathDispose($hPath) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return 0 EndFunc ;==>WM_PAINT ;--------------------------------------------------------------------------------------- Func CheckPointer(ByRef $aiCoords_ClientRel) Return _WinAPI_PtInRectEx(_WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI), $aiCoords_ClientRel[0], $aiCoords_ClientRel[1], $aiCoords_ClientRel[0] + $aiCoords_ClientRel[2], $aiCoords_ClientRel[1] + $aiCoords_ClientRel[3]) EndFunc ;==>CheckPointer ;--------------------------------------------------------------------------------------- Func GetTheme() Return $iTheme EndFunc ;==>GetTheme ;--------------------------------------------------------------------------------------- Func SetTheme($Theme, $f_Redraw = True) If GetTheme() = $Theme Then Return 1 If $Theme = 0 Then ; Idle _GDIPlus_BrushSetSolidColor($hBrush, 0xAA43A6DF) ; Blue $tRect_Coords[0] = 50 $tRect_Coords[1] = 50 ElseIf $Theme = 1 Then ; MouseDown _GDIPlus_BrushSetSolidColor($hBrush, 0xFF3685B2) ; Darker Blue $tRect_Coords[0] = 52 $tRect_Coords[1] = 52 ; Move slightly down ElseIf $Theme = 2 Then ; MouseOver _GDIPlus_BrushSetSolidColor($hBrush, 0xBB7BC1E9) ; Lighter Blue $tRect_Coords[0] = 50 $tRect_Coords[1] = 50 Else Return SetError(1, 0, 0) EndIf $iTheme = $Theme If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE)) EndFunc ;==>SetTheme ;--------------------------------------------------------------------------------------- Func _GDIPlus_PathAddRoundRect(ByRef $hPath, $iX, $iY, $iWidth, $iHeight, $iRadius) Local $iDiameter = $iRadius * 2 _GDIPlus_PathAddArc($hPath, $iX, $iY, $iDiameter, $iDiameter, 180, 90) _GDIPlus_PathAddLine($hPath, $iX + $iRadius, $iY, $iX + $iWidth - $iRadius, $iY) _GDIPlus_PathAddArc($hPath, $iX + $iWidth - $iDiameter, $iY, $iDiameter, $iDiameter, 270, 90) _GDIPlus_PathAddLine($hPath, $iX + $iWidth, $iY + $iRadius, $iX + $iWidth, $iY + $iHeight - $iRadius) _GDIPlus_PathAddArc($hPath, $iX + $iWidth - $iDiameter, $iY + $iHeight - $iDiameter, $iDiameter, $iDiameter, 0, 90) _GDIPlus_PathAddLine($hPath, $iX + $iWidth - $iRadius, $iY + $iHeight, $iX + $iRadius, $iY + $iHeight) _GDIPlus_PathAddArc($hPath, $iX, $iY + $iHeight - $iDiameter, $iDiameter, $iDiameter, 90, 90) _GDIPlus_PathAddLine($hPath, $iX, $iY + $iHeight - $iRadius, $iX, $iY + $iRadius) EndFunc ;==>_GDIPlus_PathAddRoundRect ;--------------------------------------------------------------------------------------- have fun Thank you very much1 point
-
Hi. Local $aArray[2]=[DllStructCreate("dword TokType;wchar Token[100]"),DllStructCreate("dword TokType;wchar Token[100]")] $aArray[0].TokType=1 $aArray[0].Token="Hola" $aArray[1].TokType=2 $aArray[1].Token="Mundo" ConsoleWrite($aArray[0].TokType() & " " & $aArray[0].Token() & @CRLF) ConsoleWrite($aArray[1].TokType() & " " & $aArray[1].Token() & @CRLF) Saludos1 point
-
Implement the following into your code Global $ExitLoop = False ; A global variable to hold state HotKeySet("{ESC}","_ExitLoop") ; Make a function to change state to true Func _ExitLoop() ; Make a function to change state to true $ExitLoop = True EndFunc $ExitLoop = False ; Before entering your endless loop, set state to false While 1 If Not $ExitLoop Then ; Only Send if state is false Send($send1) Sleep($sleep1) Else ExitLoop ; Else exit the loop EndIf WEnd1 point