Archive: Gradual progress bar when install applications silently


Gradual progress bar when install applications silently
  Hello all,

I've been looking through progress bar threads in this forum and haven't find what I need yet. I have an installer which installs a few applications base on user's selection.

The problem I am having: if an application A is installing silently, the progress status doesn't increase until installation is completed, or just barely increase that user can't even notice. For example, at the beginning of application A installation, progress is positioned at 8%, then after installation, it would jumps to 15%. One application could take up to 2 minutes to install, and since there is no increase in progress bar, it gives user an impression that the installation hangs.

Number of applications to be installed varies depend on user's selection so I can't pre-defined the percentage of progress bar to each app.

Any help/pointer is greatly appreciate.

Thanks!


You could pop up a little dialog with a marquee style progressbar (the kind that runs from left to right indefinitely) using Nxs:
http://nsis.sourceforge.net/Nxs_plug-in

Just pop it up before you install the app and close it when done.

If you're installing a bunch of things in silent mode one after the other, you can use its update function to change the text displayed, or get the window handle and play with the controls from there.


Thanks Animaether!

1. Do you know if there is an option to disable the blue screen display in the background "^Name Setup" ?

2. I want to have an option for user to hide the progress bar if they don't want to see it anymore.

nxs::Show /NOUNLOAD "$(Installing)..." /top "$(Installing)..." /h 0 /can 1 /marquee 50 /end

nxs::getWindow /NOUNLOAD
Pop $0 ; $0 now contains the handle to the dialog
GetDlgItem $1 $0 2 ; button=2; top=8; progress=10; sub=11; icon=12
SendMessage $1 ${WM_SETTEXT} 1 "STR:&Hide" ; Change button label &Cancel to &Hide
StrCpy $1 -1

ExecWait "Setup.exe /S" $ExitCode5

sleep:
IntOp $1 $1 + 1
Sleep $1

nxs::HasUserAborted /NOUNLOAD
Pop $0 ; $0 now contains "1" if user clicked Cancel or "0" otherwise.
StrCmp $0 1 destroy
StrCmp $1 100 0 sleep

destroy:
nxs::Destroy

----------
The problem is I use "ExecWait", so it won't able to check if user click "Hide" button.


I able to disable the background (question 1 above).


The big gradiented blue background is unrelated to NxS - it's just part of the example files. Here's a more minimal example.

Name"Nxs example"

!addplugindir "."
!include "MUI2.nsh"
!include "WinMessages.nsh"

XPStyle on ; Required for Marquee-style progressbars! already defined in MUI, but just in case...
ShowInstDetails show

OutFile "test.exe"

Page instfiles


!define MUI_CUSTOMFUNCTION_GUIINIT onGuiInit

Function onGUIInit
; plug-in requires this to be called in .onGUIInit
; if you use it in the .onInit function.
; If you leave it out the installer dialog will be minimized.
ShowWindow $HWNDPARENT 2
FunctionEnd

Section
StrCpy $0 "Windows Installer"
DetailPrint "Installing $0"
nxs::Show /NOUNLOAD `$(^Name) Setup` /top `Installing third party software$\r$\nPlease wait...` /sub `$\r$\n$\r$\n$0` /h 0 /marquee 30 /end
Sleep 3000 ; simulate installing something...

StrCpy $0 "Microsoft .NET Framework"
DetailPrint "Installing $0"
nxs::Update /NOUNLOAD /sub `$\r$\n$\r$\n$0` /h 0 /marquee 30 /end
Sleep 3000 ; simulate installing something...

StrCpy $0 "SUN Java Run-Time Environment"
DetailPrint "Installing $0"
nxs::Update /NOUNLOAD /sub `$\r$\n$\r$\n$0` /h 0 /marquee 30 /end
Sleep 3000 ; simulate installing something...

nxs::Destroy
SectionEnd

!insertmacro MUI_LANGUAGE "English"
If you want to hide the progressbar, then check whether the user has aborted, destroy the dialog, and set a little variable that you can check that so that you won't open/update/destroy it when it no longer exists.