Archive: Re: Dynamic CustomPage Text


Re: Dynamic CustomPage Text
I am relatively new to NSIS, but have compiled a pretty complex NSIS installer for multiple OS's. The problem I am running in to is this. There are several already packaged components that may need to be installed if necessary. I have code to check if they need to be installed. What I am trying to do is create a custom page before the MUI_PAGE_DIRECTORY page comes up. What I want it to do is dynamically add the component names to the screen so the users will see what needs to be installed.

i.e.

Data Component #1 (Displayed - not already installed)
Data Component #2 (Not displayed - installed)
Data Component #3 (Displayed - not already installed)

What I already have are certain variable such as Component1, Component2, etc that either store a "yes" or "no" if it is installed. For each "no", I want the item description to be put up on the page. Since this will vary from user to user and cannot be determined at compile time, it needs to be dynamic. Any ideas? If this was VB, VC++, Delphi, PHP I would be able to figure it out no problem. On a side note, NSIS is much better than any of the installers I have worked before. Installshield is one of the worst. Thanks!


To create a custom page, you can use InstallOptions. Contrib\InstalOptions contains examples and a readme. Examples\Modern UI\InstallOptions.nsi is a usage example in combination with the MUI.

You can create a custom page with a text box or a label and generate the text at runtime according to those variables. You can then write the text to the STATE field of the text box or the TEXT field of the label. For example (using MUI):

!insertmacro MUI_INSTALLOPTIONS_WRITE "customPage.ini" \
"Field 2" "Text" "component #1\r\n\r\ncomponent #2"