max23ed Posted November 15, 2019 Share Posted November 15, 2019 This is the code but i'm getting it to work for one progress bar fill. How can i check if the progress bar completely finished filled x amount of times. While _SendMessage($hWnd_Progress,$PBM_GETPOS,0,0) < 100 Sleep(500) WEnd The progress bar is from a setup which for some reason needs to fill multiple times. I need to pause the script until the progress bar is done. Any ideas. Thanks Link to comment Share on other sites More sharing options...
Zedna Posted November 15, 2019 Share Posted November 15, 2019 (edited) Maybe something like this? $prev = 0 $value = 0 $cycle = 1 $cycle_max = 3 While $value < 100 $value = _SendMessage($hWnd_Progress,$PBM_GETPOS,0,0) If $value < $prev Then $prev = 0 ; $value = 0 $cycle += 1 EndIf If $value <> $prev Then $prev = $value If $cycle = $cycle_max Then ... ; pause? Sleep(500) WEnd Edited November 15, 2019 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
max23ed Posted November 15, 2019 Author Share Posted November 15, 2019 Thanks for the reply Zenda, This is complicated for me i'm checking all the controls on the setup window this is the function expandcollapse popupFunc GetAllWindowsControls($hCallersWindow, $bOnlyVisible=Default, $sStringIncludes=Default, $sClass=Default) local $found = 0 If Not IsHWnd($hCallersWindow) Then ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF) Return False EndIf If $bOnlyVisible = Default Then $bOnlyVisible = False If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" $sClassList = WinGetClassList($hCallersWindow) $aClassList = StringSplit($sClassList, @CRLF, 2) _ArraySort($aClassList) _ArrayDelete($aClassList, 0) $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 If StringLen($sClass)>0 Then For $i = UBound($aClassList)-1 To 0 Step - 1 If $aClassList[$i]<>$sClass Then _ArrayDelete($aClassList,$i) EndIf Next EndIf For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf $found = 0 $a = $iCurrentClass & $iCurrentCount If StringInStr($a, "ComboBox") And $bIsVisible Then $found = 1 Sleep(3000) ExitLoop else If StringInStr($a, "Button") And $bIsVisible Then $found = 1 Sleep(3000) ExitLoop else if StringInStr($a,"msctls_progress321") And $bIsVisible Then $found = 1 $progressIsnotVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") $hWnd_Progress = ControlGetHandle("[Active]","",$a) $prev = 0 $value = 0 $cycle = 1 $cycle_max = 3 While $value < 100 $value = _SendMessage($hWnd_Progress,$PBM_GETPOS,0,0) < 100 If $value < $prev Then $prev = 0 ; $value = 0 $cycle += 1 EndIf If $value <> $prev Then $prev = $value If $cycle = $cycle_max Then ; pause? Sleep(500) EndIf WEnd ExitLoop Else Sleep(1000) EndIf EndIf EndIf EndIf EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next If $found = 1 Then $found = 0 Return true EndIf EndFunc Then before each mouseclick i do somthing like this to check if anything visible at all in the setup especially the progress bar 😠 do Sleep(500) until GetAllWindowsControls(WinGetHandle('[ACTIVE]')) = true MouseClick("left",146,128,1) Any help on how i can achieve this. Link to comment Share on other sites More sharing options...
Nine Posted November 15, 2019 Share Posted November 15, 2019 1 hour ago, Zedna said: $value = _SendMessage($hWnd_Progress,$PBM_GETPOS,0,0) < 100 That seems highly suspicious as it returns True or False... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Zedna Posted November 15, 2019 Share Posted November 15, 2019 @nine fixed Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
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