I have an NSIS installer set to run in silent mode. This works very well.
I've had a customer request for an informational pop up once the install has complete...but still wants the installer portion to be silent!
I realize this is counter intuitive.
That being said is there away to override the silent at the end of the install?
I currently set the installer attribute below at the beginning of the .nsi script
SilentInstall silent
You can toggle silent mode on or off in .onInit
with SetSilent
but once that function returns the UI mode cannot be changed.
The simple solution is to simply use one of the Banner or Splash plug-ins at the end of your last Section
to display a message/image.
Or you can create a fake silent mode with a minimal UI that only displays the progress bar:
!include LogicLib.nsh
Var Silent
Function .onInit
${If} ${Silent}
SetSilent Normal ; Turn off real silent mode
SetAutoClose True
StrCpy $Silent 1 ; Fake silent mode
${EndIf}
FunctionEnd
Page Components SkipPageIfSilent
Page Directory SkipPageIfSilent
Page InstFiles "" TweakInstfilesPage
Function SkipPageIfSilent
IntCmp $Silent 0 +2
Abort
FunctionEnd
Function TweakInstfilesPage
${If} $Silent <> 0
SetSilent Silent ; Make IfSilent return true
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 0x403 ; Show details button
ShowWindow $0 0
System::Call 'USER32::GetWindowRect(p$0,@r1)' ; NSIS v3+
System::Call 'USER32::GetWindowRect(p$HWNDPARENT,@r2)' ; NSIS v3+
System::Call '*$1(i,i.r3,i,i)'
System::Call '*$2(i.r5,i.r6,i.r7,ir3r8)'
IntOp $5 $7 - $5 ; Width
IntOp $6 $8 - $6 ; Height
System::Call 'USER32::SetWindowPos(p$HWNDPARENT,p,i,i,ir5,ir6,i0x12)'
SetDetailsView Hide
${EndIf}
FunctionEnd
Section
Sleep 333
Sleep 333
Sleep 333
Sleep 333
SectionEnd
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.