Skip to content
⌘ NSIS Forum Archive

Progress bar question

16 posts

Guest#

Progress bar question

Is there a way to make the nxs plugin progress bar not satic, but a looping 0 to 100, while searching for something?
Afrow UK#
If searching for a file, the only logical way to do this is to count how many files you are searching in first, or to make a rough estimate somehow.

-Stu
Guest#
Sorry if I was not clear... It is like a fake moving bar only to avoid the static one. It would go from 0 to 100 and start again from 0 to 100 until locating process stops.
Afrow UK#
Right, in that case just have a variable that you increment by say 2 for each file you loop through...

; Init progress bar
NXS::Show /NOUNLOAD ...

RestartProgressBar:
StrCpy $R0 0

Loop:
IntOp $R0 $R0 + 2

; Update progress bar
NXS::Update /NOUNLOAD ...

; Do your stuff here

StrCmp $R0 100 RestartProgressBar Loop
End:

; Destroy progress bar
NXS:😁estroy
-Stu
Guest#
Thanks, you are the man 🙂

After some thinking I have found another way to do it with a looping variable. For those interested (remeber to put /pos 0 /max 100 in nxs::Show):

Var looping

...

loop:
nxs::Update /NOUNLOAD ... /pos $looping ...
IntOp $looping $looping + 1
StrCmp $looping 100 zero

zero:
IntOp $looping $looping - 100
Goto loop
lophung#
NXS question.... need help!

I have tried to use the nxs example provided to create a "progress bar" but for some reason the progress bar is not moving... can someone please tell me what I have done incorrectly? thanks!

here is my script:

NXS::Show /NOUNLOAD "OpenClient setup" /top "Extracting Open Client setup files for installation" /sub "Extracting..." /h 0 /pos 0 /max 100 /can 0 /end

RestartProgressBar:
StrCpy $R0 0

Loop:
IntOp $R0 $R0 + 2

; update progress bar
nxs::Update /NOUNLOAD 'Extracting...'

; extract files to directory directory
SetOutPath "$INSTDIR\temp\"
File /r "${BASEDIR}\pcclient"

StrCmp $R0 100 RestartProgressBar Loop

End:
NXS:😁estroy


Any help from the gurus would greatly be appreciated.
Afrow UK#
You aren't telling it what the new progress value is with the Update call.

I used ... in the example, which is where you must put the parameters you want. See the plugin readme.

-Stu
lophung#
Is this correct?

so is the following correct?

; update progress bar
NXS::Update /NOUNLOAD /sub 'Extracting...' /pos $R0 /end

Or am I still way off?

Thanks.
lophung#
yes, i just tried it about a minute ago.
the progress bar only shows one space moved but does not progressively move along.
Afrow UK#
I see what you're doing now. File /r is just one instruction, so you're simply calling it 50 times.
If you want better progress indication, use individual File instructions.

-Stu
lophung#
so what if i did a "File /r"
would there still be a way to use a progress bar with that?

sorry for asking so many questions.
Comperio#
The only way you can update the progress bar during a file extraction is to be able to update the progress bar in between file extraction (which is why you'd need to use multiple file commands.)

Other possibilities:
1) You might check out Afrow's RealProgress plugin to allow the progress bar to move while extracting files. (Would stil have to use multiple file commands.)

2) Another thought is to display an animated gif during installation using Takhir's Animated gif plugin.
Afrow UK#
I could possibly add a progress function to the RealProgress plugin where you give it the number of new items to be printed and it will change the progress bar through that.

-Stu
Afrow UK#
You can try the DetailProgress function that I added in the RealProgress plugin:


-Stu