Archive: Select which screens to display within MUI


Select which screens to display within MUI
Is it possible to select which screens to display as part of the Modern UI.

For example below if DontInstall is false then just finish:

;--------------------------------
;Modern UI Configuration

!define MUI_WELCOMEPAGE
!define MUI_LICENSEPAGE
StrCmp DontInstall 'false' DontInstallPage
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
DontInstallPage:
!define MUI_FINISHPAGE


But I get:

Error: command StrCmp not valid outside section or function


Installoptions
I know how to do this with an Installoptions Dialog

you just have to write this part of Code at the beginning of the Page function:

!insertmacro MUI_INSTALLOPTIONS_READ $SHOW "IO_PAGE.ini" "Field 1" "State"
StrCmp $R1 "1" +2 0
Abort

If the Value of "state" in "Field 1" is '1' it proceeds showing the page because jumps over the abort-instruction
if the value isnt '1' it proceeds with abort and so it goes to the next function

Check the Readme in the contrib\InstallOptions Folder for further information about the IO Dialogs

hope this helps


This is okay for a custom page, but it's for all the other pages I don't want to display


Hi :)

Yes it is possible, but not that way.. You should :


1) Sets the flags and values you need, using define. For instance:

!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_SHOWREADME

2) Set the order of *all* the pages of your installer,
no matter which page are displayed or not, using
insertmacro and NOT define

; Installer
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "c:\blabla\MyLicenceFile.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

; Uninstaller
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES


3) For each page you have three functions. From the doc:
(http://nsis.sourceforge.net/Docs/)

4.5.3 Callbacks

Each built-in page has three callback functions. The pre-function, the show-creation function and the leave-function. The pre-function is called right before the page is created, the show-function is called right after it is created and before it is shown and the leave-function is called right after the user has pressed the next button and before the page is left.

* The pre-function allows you to skip the page using Abort.
* The show-function allows you to tweak the page's user interface with CreateFont, SetCtlColors, SendMessage and others.
* The leave-function allows you to force the user to stay on the current page using Abort.
The function you need is the "pre-function". Let's say you want to skip the directory page:


- First you have to define the "pre-function" associated with the Directory page.

Insert
!define MUI_PAGE_CUSTOMFUNCTION_PRE MyDirectoryPage_Pre

Before

!insertmacro MUI_PAGE_DIRECTORY


- Then you test the value in this function:


Function MyDirectoryPage_Pre
StrCmp DontInstall true 0 end
Abort

end:
FunctionEnd




Ok I think that's it.. Oh, and which version of NSIS do you use ? I've noticed your macros
have "old" names... Maybe you should download the last version...

evilO/Olive

Great, many thanks :-)