kor Posted March 17, 2012 Posted March 17, 2012 #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $progressbar1, $progressbar2, $button, $wait, $s, $msg, $m GUICreate("My GUI Progressbar", 220, 100, 100, 200) $progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20) $button = GUICtrlCreateButton("Start", 75, 70, 70, 20) GUISetState() Local $i = 0 Do $msg = GUIGetMsg() If $msg = $button Then GUICtrlSetData($progressbar1, $i += 10) Sleep(300) GUICtrlSetData($progressbar1, $i += 10) Sleep(300) GUICtrlSetData($progressbar1, $i += 10) Sleep(300) GUICtrlSetData($progressbar1, $i += 10) Sleep(300) GUICtrlSetData($progressbar1, $i += 10) Sleep(300) EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Modified sample script from the GuiCtrlCreateProgress When I try and run I get an error parsing function call with the $i += 10 I'm not sure why I can't preform this operation.
Moderators JLogan3o13 Posted March 17, 2012 Moderators Posted March 17, 2012 Hi, kor. A couple of ways you can do it, as GUICtrlSetData does not like the += attempt at incrementing. From your example, this is the simplest: #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $progressbar1, $progressbar2, $button, $wait, $s, $msg, $m GUICreate("My GUI Progressbar", 220, 100, 100, 200) $progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20) $button = GUICtrlCreateButton("Start", 75, 70, 70, 20) GUISetState() Local $i = 0 Do $msg = GUIGetMsg() If $msg = $button Then GUICtrlSetData($progressbar1, $i + 10) Sleep(300) GUICtrlSetData($progressbar1, $i + 20) Sleep(300) GUICtrlSetData($progressbar1, $i + 30) Sleep(300) GUICtrlSetData($progressbar1, $i + 40) Sleep(300) GUICtrlSetData($progressbar1, $i + 50) Sleep(300) EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
kor Posted March 17, 2012 Author Posted March 17, 2012 I cheated and took the easy way out. $iBarCount += 5 ; step the precentage GUICtrlSetData($hBar, $iBarCount) ; set the progress bar percentage Sleep(200) ; sleep to allow time to see progress step and read messages
Moderators JLogan3o13 Posted March 17, 2012 Moderators Posted March 17, 2012 Easy is what we're aiming for. Glad you worked it out "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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