I have a script that loops through some records. I'd like a status bar since this can run anywhere from seconds to 10 or 15 minutes. I found the sample code I will post below. My question is, how do I update the bar as part of processing my loop?
thanks again, -Bob
My loop is similar to this:
Let>k=0
Repeat>k
Let>k=k+1
// do something
Until>k=5
Here is the sample status bar I have:
//Progress bar dialog
Dialog>dlgProgress
Caption=Progress
Width=451
Height=67
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=0
Resize=0
progressbar=bar1,0,8,441,16,0
EndDialog>dlgProgress
Let>dlgProgress.bar1=1
Show>dlgProgress
Let>progress=0
Repeat>progress
Add>progress,1
Wait>0.05
// do stuff
// ...
// ...
// now update the progress bar
Add>dlgProgress.bar1,1
ResetDialogAction>dlgProgress
Until>progress=100
progress bar and loop example
Moderators: JRL, Dorian (MJT support)
Re: progress bar and loop example
You need to have all going on happening in one loop so combine the two. Since the "k" loop only loops five times the progress bar is increasing by 20 each loop cycle.
Code: Select all
Here is the sample status bar I have:
//Progress bar dialog
Dialog>dlgProgress
Caption=Progress
Width=451
Height=67
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=0
Resize=0
progressbar=bar1,0,8,441,16,0
EndDialog>dlgProgress
Let>dlgProgress.bar1=1
Show>dlgProgress
Let>progress=0
Let>k=0
Repeat>k
Let>k=k+1
// do something
// now update the progress bar
Add>dlgProgress.bar1,20
ResetDialogAction>dlgProgress
Wait>1
Until>k=5
Add>progress,1
Re: progress bar and loop example
Awesome! Thank you for this. -Bob