Progress Bar applied to process - EXAMPLE

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
clickfast
Pro Scripter
Posts: 58
Joined: Wed May 23, 2007 12:04 am

Progress Bar applied to process - EXAMPLE

Post by clickfast » Sun Apr 13, 2008 8:58 pm

Hey folks, the good news.... i've read the top 10 posts on Progress bars, including the example listed in the Help file. None of them show a complete example of how to apply a progress bar to a loop or an iterative process. Marcus gives a great description of what to do here http://www.mjtnet.com/usergroup/viewtop ... rogressbar... but for us novice coders... it doesn't say exactly HOW to do it. :?:

Here's the progress bar in the MS help file i'm trying to use.

Code: Select all

Dialog>dlgProgress
   Caption=Progress
   Top=150
   Width=451
   Left=20
   Height=43
   ProgressBar=progressbar,0,0,441,16,0
EndDialog>dlgProgress

Show>dlgProgress

Let>k=1
Repeat>k
  Let>dlgProgress.progressbar=k
  ResetDialogAction>dlgProgress
  Wait>3
  Let>k=k+1
Until>k,100
For this example, I have a process that executes a file every 20 minutes for an hour and I want show the user a progress bar that updates at each 20 minute interval all the way up to 100% completion.

Code: Select all


Let>RP_WINDOWMODE=2
RUN>update.exe
WAIT>1200
//UPDATE TO 20% PROGRESS

Let>RP_WINDOWMODE=2
RUN>update.exe
WAIT>1200
//UPDATE TO 40% PROGRESS

Let>RP_WINDOWMODE=2
RUN>update.exe
WAIT>1200
//UPDATE TO 60% PROGRESS

Let>RP_WINDOWMODE=2
RUN>update.exe
WAIT>1200
//UPDATE TO 80% PROGRESS

Let>RP_WINDOWMODE=2
RUN>update.exe
WAIT>1200
//UPDATE TO 100% PROGRESS

I know this is probably easy and there's something I just don't get... but i've thought long and hard...and still can't make it work!!! :(

Also, I probably could cleanup the code by running it in a loop for so many cycles :idea:...but i don't know how to do that...:shock: so i did it the old skool way

Thanks in advance for any help you can give. :D

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 14, 2008 2:47 am

You need to use the Dialog that was in the sample.

And you need to replace "k" with some other value, and replace the "100" with the total to be done..
For instance, k = calculate the elapsed time; 100 - the total expected time.
Or k = calculate the bytes copied ; "100 = total bytes to be done.


Here is a general concept, sorry no time to do code correctly now....

Make a loop to do the following

Code: Select all


Let>total=TotalFileSize

Let>k=FileSizeCopied
Repeat>k
  Let>dlgProgress.progressbar=k
  ResetDialogAction>dlgProgress
  Wait>3
  FileSize>NewFileName,k
Until>k,%total%
Show us the finished code so we can have another example.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts