example reads first file (0-100%) than changes color from progressbar and reads second file ( 0-100% )
Code: Select all
;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=35793 ---
i=0
f1=%a_scriptdir%\test1.txt
ifexist,%f1%
filedelete,%f1% ;- in test
ifnotexist,%f1%
{
loop,150
{
i++
e .= "This is LineXX=" . i . "`r`n"
}
fileappend,%e%,%f1%
}
e=
i=0
f2=%a_scriptdir%\test2.txt
ifexist,%f2%
filedelete,%f2% ;- in test
ifnotexist,%f2%
{
loop,300
{
i++
e .= "This is LineXX2=" . i . "`r`n"
}
fileappend,%e%,%f2%
}
e=
gui,2: -SysMenu
Gui,2: Font,s14, Comic Sans MS
Gui,2: Add, Text, vMSG x10 y90 h30 w500, loading...
Gui,2 :Add, Progress, x10 y10 w500 h20 vPRBAR cFF7200 range0-100
Gui,2: Add, Text, x10 y35 w500 h20 vText22,
Gui,2: Add, Text, x10 y60 w500 h20 vText23,
Gui,2: Add, Button, vStop gStop x210 y115 w100 h22,stop
; focus on other control-id to unfocus the default button (prevent pressing the space button to select it)
GuiControl,2: Focus, msg
;
Gui,2:Show,h140 , test123
FileRead, Text, %f1%
total=0
a=0
Loop, Parse, Text, `n, `r
total := (A_Index-1)
Loop, Parse, Text, `n, `r
{
lf=%a_loopfield%
if lf=
continue
A +=1
RES1:=Round((100*A)/TOTAL)
GuiControl,2:,PRBAR, %RES1%
GuiControl,2:,Text22,%A%\%TOTAL% %RES1% `%
GuiControl,2:,Text23,%LF%
;MsgBox, %a_loopfield%
sleep, 50
}
;GuiControl,2:,Text23,ENDED
text1=
;- test changecolor prbar
c=Gray
GuiControl,2: +c%c%, prbar
FileRead, Text2, %f2%
total=0
a=0
Loop, Parse, Text2, `n, `r
total := (A_Index-1)
Loop, Parse, Text2, `n, `r
{
lf=%a_loopfield%
if lf=
continue
A +=1
RES1:=Round((100*A)/TOTAL)
GuiControl,2:,PRBAR, %RES1%
GuiControl,2:,Text22,%A%\%TOTAL% %RES1% `%
GuiControl,2:,Text23,%LF%
sleep, 50
}
;GuiControl,2:,Text23,ENDED
text2=
;- test changecolor prbar
c=Gray
GuiControl,2: +c%c%, prbar
GuiControl,2: hide, stop
GuiControl,2: hide, msg
Gui,2: Font,s14 c0x008000, Comic Sans MS
Gui,2: Add, Text, x10 y90 h30 w500, finished!
Gui,2: Add, Button, gExit x210 y115 w100 h22,exit
Gui,2: Font,
return
Stop:
Gui,2:submit,nohide
MsgBox 0x2004, , cancel ?
IfMsgBox Yes, {
MsgBox, Canceled!
} Else IfMsgBox No, {
GuiControl,2: Focus, msg
return
}
Exit:
2Guiclose:
exitapp
;==========================================================================