Help with Progress bar Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Tomer
Posts: 152
Joined: 21 Aug 2016, 05:11

Help with Progress bar

13 Aug 2017, 02:20

hii
i guess this may be very simple for you to solve:

i would like have the progrss bar to be completed (100%) once the reading of list file is finished,
problem is the progress bar is completed to 100% before the read-list is finished.


Code: [Select all] [Download] GeSHi © Codebox Plus

Loop, read, c:\file.txt
{
Progress, %a_index%, %A_LoopReadLine%, Installing..., Draft Installation
Sleep, 50
}


thanks for any help..
Helgef
Posts: 1884
Joined: 17 Jul 2016, 01:02
Contact:

Re: Help with Progress bar  Topic is solved

13 Aug 2017, 03:52

Hello.
You need to set the progress in relation to the number of lines of the file. If you have 100 lines in file.txt, your code will end at 100 % progress. I'd do something like this,

Code: [Select all] [Download] GeSHi © Codebox Plus

fileRead, fileContent, file.txt
strReplace(fileContent,"`n","`n",lineCount) ; Count the number of lines

Loop, Parse, fileContent, `n, `r
{
Progress, % p:= round(100 * (A_Index-1) / lineCount,2), %A_LoopField% `n %p% `%, Installing..., Draft Installation
Sleep, 250
}

Cheers
Tomer
Posts: 152
Joined: 21 Aug 2016, 05:11

Re: Help with Progress bar

13 Aug 2017, 04:14

Thanks Helgef,
thats working great.
i also liked the percentage show.

i came up with this code too,
which works for me good as well but its looks more complicated,
what your prefers\thoughts ?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Helgef
Posts: 1884
Joined: 17 Jul 2016, 01:02
Contact:

Re: Help with Progress bar

13 Aug 2017, 05:14

Hello.
Short answer: if it is working for you, great :thumbup:
Slightly less short answer: It is a little wasteful to count the lines twice, that is, both Lines and count, holds the number of lines. Since you read the file with FileRead, Text, %1%, you might aswell use loop, parse instead of loop, read, to avoid reading the file again. I do not see where you use files:=(files ? "`n" : "") . A_LoopFileFullPath. Maybe that is part of a bigger script.

Cheers.
garry
Posts: 904
Joined: 22 Dec 2013, 12:50

Re: Help with Progress bar

13 Aug 2017, 06:54

thank you for the examples , here an example with GUI

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Tomer
Posts: 152
Joined: 21 Aug 2016, 05:11

Re: Help with Progress bar

13 Aug 2017, 11:56

Very impressive garry! Will check it out at work tomorrow.
Thanks!!
Helgef
Posts: 1884
Joined: 17 Jul 2016, 01:02
Contact:

Re: Help with Progress bar

13 Aug 2017, 12:07

Nice indeed garry. :wave:

Return to “Ask For Help”

Who is online

Users browsing this forum: buttshark, Google [Bot], TAC109, thenasos, Yahoo [Bot] and 19 guests