Page 1 of 1

advancing my progress bar

Posted: Thu Mar 29, 2012 9:23 am
by FireWorx
Hi can someone help me with a little code to advance a progress bar for about a 4 second operation that involves getting the files of a folder and sending the list of files through several repeat loops to do some error checking regarding the file names, types,etc then does some math, etc, locks the screen, resizes some groups, and then eventually unlocks the screen.

I was using a handler in the stack and a progress bar i got from tactile media hence the "tm" before the commands in the script below. Then where ever I could find a repeat loop sticking the "ShowProgress" handler in to try and advance the progress bar but it wash"t really working well at all. Is there a way I can get it to march along for say 4 seconds and then when the script ends just hide it? Any help would be appreciated.
Dave

global tCurrentProgress
on ShowProgress
set the tmEndValue of control "myProgress" to 20
   put the tmThumbPos of control "myProgress" into tCurrentProgress
       if tCurrentProgress >= the tmEndValue of control "myProgress" then
put 0 into tCurrentProgress
else
   add 1 to tCurrentProgress
    end if
   set the tmThumbPos of control "myProgress" to tCurrentProgress
end ShowProgress

Re: advancing my progress bar

Posted: Thu Mar 29, 2012 9:56 am
by Mark
Hi,

I only know how to do this for regular progress bars. First of all, note that progress bars are not time-related. They are activity-related and are updated using counters. For example, if you have a list with files:

Code: Select all

set the endValue of scrollbar "Progress" to the number of lines of myFileList
put 0 into myCounter
repeat for each line myFile in myFileList with messages
  add 1 to myCounter
  // do something with file myFile
  set the thumbPos of scrollbar "Progress" to myCounter
  wait 0 millisecs with messages
end repeat
Kind regards,

Mark

Re: advancing my progress bar

Posted: Thu Mar 29, 2012 3:59 pm
by FireWorx
Thanks,
That should help I will give it a try.
Dave