Progress is slower than counter

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
foxhunter
Posts: 72
Joined: 04 Aug 2016, 04:27

Progress is slower than counter

31 Dec 2016, 09:32

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
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Progress is slower than counter

31 Dec 2016, 10:07

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
}
foxhunter
Posts: 72
Joined: 04 Aug 2016, 04:27

Re: Progress is slower than counter

31 Dec 2016, 10:24

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.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Progress is slower than counter

31 Dec 2016, 20:38

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.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: OrangeCat, scriptor2016 and 118 guests