JellyFish666 Posted February 13, 2008 Share Posted February 13, 2008 Hello I am wondering what would be the best way to do this, since progress bars are maxed at 100 (max number) say you have three of them the first two of them are used to calculate certain information and the third one is the total progress how would you fine out the total progress? I hope this example will help I am not sure how to word it properly, in my example it is just adding the two of them to calculate the total progress. #include <GUIConstants.au3> $GUI = GUICreate("Form1", 150, 400) $Progress1 = GUICtrlCreateProgress(0, 0, 150, 15) GUICtrlSetData($Progress1 , 50) $Progress2 = GUICtrlCreateProgress(0, 20, 150, 15) GUICtrlSetData($Progress2 , 50) $Progress3 = GUICtrlCreateProgress(0, 40, 150, 15) GUISetState(@SW_SHOW) Sleep(1000) GUICtrlSetData($Progress3 , GUICtrlRead($Progress1) + GUICtrlRead($Progress2)) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
DW1 Posted February 13, 2008 Share Posted February 13, 2008 You almost had it, but since you added two percentages together and want to find when both are done, you needed to divide by 2: #include <GUIConstants.au3> $GUI = GUICreate("Form1", 150, 400) $Progress1 = GUICtrlCreateProgress(0, 0, 150, 15) $Progress2 = GUICtrlCreateProgress(0, 20, 150, 15) $Progress3 = GUICtrlCreateProgress(0, 40, 150, 15) GUISetState(@SW_SHOW) Sleep(1000) GUICtrlSetData($Progress3 , GUICtrlRead($Progress1) + GUICtrlRead($Progress2)) $avar = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $avar += 1 Sleep(100) If $avar < 101 Then GUICtrlSetData($Progress1 , $avar) EndIf If $avar > 100 Then GUICtrlSetData($Progress2 , $avar - 100) EndIf GUICtrlSetData($Progress3 , (GUICtrlRead($Progress1) + GUICtrlRead($Progress2)) / 2) If GUICtrlRead($Progress3) = 100 Then MsgBox(0, "Progress", "Both pregress bars are done" ) GUICtrlSetData( $Progress1, 0 ) GUICtrlSetData( $Progress2, 0 ) GUICtrlSetData( $Progress3, 0 ) $avar = 0 EndIf WEnd AutoIt3 Online Help 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