Archive: A Preselect page in setup


A Preselect page in setup
Hello
I´m looking for a possibility to get a second components page in my installer. The user should have to decide first between two mainthemes of the installation. I have for each of them a componets page. For example: when setup starts you can decide if you want to install "game 1" or "game 2". then you can choose the options. It is unpossible to make 2 setup runtimes because they would have t large, to i can´t put the on one cd.

If there is a possiblity and if you understand my little bit worst english, could anyone post the code for it.

Thank you very much

Dark^Listner


Create a custom page using InstallOptions to begin with.
Based on the user's selection on there, you can decide which sections should be hidden from the single components page (so effectively you have two components pages, but it is in fact one with a selected list of items to install).

To hide a section, set its text to "" with SectionSetText.

As for displaying which game is being installed on those pages, set Name to a variable like so:

Var $NAME
Name $NAME

Function .onInit
StrCpy $NAME "My Installer Name"
FunctionEnd


When you change the value of $NAME, it shall be reflected on the installer pages.

Stu

Sorry, but i don´t understand one thing. :-)
normaly all options on the componets page are activate, so it is a problem to hide these option, because the user can´t see them so he also can´t disactivate them. so if have to disable all options first. right? but i don´t know how?

thx for your answers


------------------------------------
is it possible to post the whole code foor a custome page which to radiobuttons and th command to hide or display the components, because my problems starts in making a new page
thank you


Before displaying the components page, you select and hide the sections that you do not want to have installed using !insertmacro SelectSection (from Sections.nsh) and SectionSetText "".

Your code might look something like this:


!include LogicLib.nsh
!include Sections.nsh

!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPagePre
!insertmacro MUI_PAGE_COMPONENTS

Section "" GAME1_1
...
SectionEnd

Section "" GAME1_2
...
SectionEnd

Section "" GAME2_1
...
SectionEnd

Section "" GAME2_2
...
SectionEnd

Function ComponentsPagePre

# Which game to install?
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "my ini file.ini" "Field 1" "State"

# Install game 1.
${If} $R0 == 1

# Show and select all game 1 components.
!insertmacro SelectSection ${GAME1_1}
!insertmacro SelectSection ${GAME1_2}
SectionSetText ${GAME1_1} "Game 1 Section 1"
SectionSetText ${GAME1_2} "Game 1 Section 2"

# Hide and unselect all game 2 components.
!insertmacro UnselectSection ${GAME2_1}
!insertmacro UnselectSection ${GAME2_2}
SectionSetText ${GAME2_1} ""
SectionSetText ${GAME2_2} ""

# Install game 2.
${Else}

# Show and select all game 2 components.
!insertmacro SelectSection ${GAME2_1}
!insertmacro SelectSection ${GAME2_2}
SectionSetText ${GAME2_1} "Game 2 Section 1"
SectionSetText ${GAME2_2} "Game 2 Section 2"

# Hide and unselect all game 1 components.
!insertmacro UnselectSection ${GAME1_1}
!insertmacro UnselectSection ${GAME1_2}
SectionSetText ${GAME1_1} ""
SectionSetText ${GAME1_2} ""

${EndIf}

FunctionEnd


Stu

There are dozens of InstallOptions examples. A good base INI file with two radio buttons you can use is Examples\makensis.ini

Stu


THank you very much Afrow UK
it loks good, but it doensn´d work because there is an error in "!insertmacro MUI_PAGE_COMPONENTS" nsis can´t find a file. I don´t know where what to to with a -ini file
maybe should do like !include precmop.ini?


!include MUI.nsh

This is for a Modern UI installer.

Stu


sorry, now i can compile the script but the command !define
!insertmacro MUI_PAGE_COMPONENTS makes that i have two componets pages, but it isn´t possible to get my .ini page allthough they are included in the script


EDIT: Now it works thx you so much