Make install/update easy & quiet

Add command line parameter "/runNppAfterSilentInstall" for Notepad++ installer.
This parameter launches installed Notepad++ after silent installation.
Of course, the parameter takes effect only when "/S" (silent installation) is used.

Fix partially #8514, follow up #15230

Close #15280
This commit is contained in:
Don Ho 2024-06-13 03:56:33 +02:00
parent dbdeca5b28
commit 638b5a2043

View File

@ -90,6 +90,7 @@ page Custom ExtraOptions
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchNpp" !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchNpp"
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_CONFIRM
!define MUI_PAGE_CUSTOMFUNCTION_SHOW "un.CheckIfRunning" !define MUI_PAGE_CUSTOMFUNCTION_SHOW "un.CheckIfRunning"
!insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_INSTFILES
@ -115,7 +116,7 @@ InstType "Minimalist"
Var diffArchDir2Remove Var diffArchDir2Remove
Var noUpdater Var noUpdater
Var closeRunningNpp Var closeRunningNpp
Var runNppAfterSilentInstall
!ifdef ARCH64 || ARCHARM64 !ifdef ARCH64 || ARCHARM64
; this is needed for the 64-bit InstallDirRegKey patch ; this is needed for the 64-bit InstallDirRegKey patch
@ -151,7 +152,8 @@ Function .onInit
; ;
; --- PATCH END --- ; --- PATCH END ---
; check for the possible "/closeRunningNpp" cmdline option 1st
; Begin of "/closeRunningNpp"
${GetParameters} $R0 ${GetParameters} $R0
${GetOptions} $R0 "/closeRunningNpp" $R1 ; case insensitive ${GetOptions} $R0 "/closeRunningNpp" $R1 ; case insensitive
IfErrors 0 closeRunningNppYes IfErrors 0 closeRunningNppYes
@ -175,7 +177,11 @@ closeRunningNppCheckDone:
Quit ; silent installation is silent, currently we cannot continue without a user interaction (TODO: a new "/closeRunningNppAutomatically" installer optional param...) Quit ; silent installation is silent, currently we cannot continue without a user interaction (TODO: a new "/closeRunningNppAutomatically" installer optional param...)
nppNotRunning: nppNotRunning:
notInSilentMode: notInSilentMode:
; End of "/closeRunningNpp"
; Begin of "/noUpdater"
${GetParameters} $R0 ${GetParameters} $R0
${GetOptions} $R0 "/noUpdater" $R1 ;case insensitive ${GetOptions} $R0 "/noUpdater" $R1 ;case insensitive
IfErrors withUpdater withoutUpdater IfErrors withUpdater withoutUpdater
@ -192,6 +198,20 @@ updaterDone:
!insertmacro UnSelectSection ${PluginsAdmin} !insertmacro UnSelectSection ${PluginsAdmin}
SectionSetText ${PluginsAdmin} "" SectionSetText ${PluginsAdmin} ""
${EndIf} ${EndIf}
; End of "/noUpdater"
; Begin of "/runNppAfterSilentInstall"
${GetParameters} $R0
${GetOptions} $R0 "/runNppAfterSilentInstall" $R1 ;case insensitive
IfErrors noRunNpp runNpp
noRunNpp:
StrCpy $runNppAfterSilentInstall "false"
Goto runNppDone
runNpp:
StrCpy $runNppAfterSilentInstall "true"
runNppDone:
; End of "/runNppAfterSilentInstall"
${If} ${SectionIsSelected} ${PluginsAdmin} ${If} ${SectionIsSelected} ${PluginsAdmin}
@ -358,6 +378,11 @@ FunctionEnd
Section -FinishSection Section -FinishSection
Call writeInstallInfoInRegistry Call writeInstallInfoInRegistry
IfSilent 0 theEnd
${If} $runNppAfterSilentInstall == "true"
Call LaunchNpp
${EndIf}
theEnd:
SectionEnd SectionEnd
BrandingText "The best things in life are free. Notepad++ is free so Notepad++ is the best" BrandingText "The best things in life are free. Notepad++ is free so Notepad++ is the best"