Page 1 of 1

Progress is slower than counter

Posted: 31 Dec 2016, 09:32
by foxhunter
Hello,
when using this code, you will mention, that the Counter(A_index) reaches 1000, but Progressbar has not reached the even half of the bar. Reason seems that bar "slowly" fills. Is there a possibility the speed this up, having an immediate fill?

Image

Code: Select all

Progress,  P0 M2 , subtext, maintext, CounterDemo

loop, 1000
{
 progress_step := A_index/1000*100
 Progress, %progress_step%, %A_index%, %A_index%
}
send, {PrintScreen} ; creates screenshot
pause

Re: Progress is slower than counter

Posted: 31 Dec 2016, 10:07
by Xtra
The bar fills no problem here you could be taxing your cpu using a loop with no sleep.

There is really no reason to loop 1000 times if you need to fill the bar slower use a sleep in the loop.

You could just use:

Code: Select all

Progress,  P0 M2 , subtext, maintext, CounterDemo

loop, 100
    Progress, %A_index%, %A_index%, %A_index%
or

Code: Select all

Progress,  P0 M2 , subtext, maintext, CounterDemo

loop, 100
{
    Progress, %A_index%, %A_index%, %A_index%
    Sleep 16    ; Set higher if needs to be slower
}

Re: Progress is slower than counter

Posted: 31 Dec 2016, 10:24
by foxhunter
My code was a breakdown to a simple version. Therefore I thought a loop with 1000 iterations is more practical to show the problem. I don't like to slow down my script with sleep only because the loop is faster than the visualizion of bar.

Re: Progress is slower than counter

Posted: 31 Dec 2016, 20:38
by Xtra
The bar fills no problem here
You may want to post your problem code it could be there is other issues.
I don't like to slow down my script with sleep only because the loop is faster than the visualizion of bar.
That was the whole point of slowing it down so the progress bar could been seen, otherwise there isnt much of a use for showing a progress bar.