Is there alternate way to call page custom functions during silent mode installation in NSIS?
I have some functions for each page so how could call these functions for Silent mode sequentially?
Something like this we have,
!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePagePre
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE WelcomePageLeave
!define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPagePre
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryPageLeave
!define MUI_PAGE_CUSTOMFUNCTION_PRE InstFilesPre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstFilesLeave
!define MUI_CUSTOMFUNCTION_ABORT onUserAbort
Any suggestions?
You are not supposed to perform required operations in the page functions.
If you want to support silent installs then you should set all required settings/variables to their default/preferred values in .onInit
and the actual installation steps should be performed in a Section
.
If you want to ignore my advise then you could of course call the functions as the first step in your first section:
!include LogicLib.nsh
Section
${If} ${Silent}
Call WelcomePagePre
Call ...
${EndIf}
SectionEnd
This requires that your page functions don't actually require the UI to be present (which is unlikely). In silent mode the pages are not hidden, they simply don't exist at all!