Skip to content
⌘ NSIS Forum Archive

MUI_PAGE_COMPONENTS - Setting checkbox states based on installed software?

3 posts

Guest#

MUI_PAGE_COMPONENTS - Setting checkbox states based on installed software?

Is there any way to set the checkbox states for the install components in MUI_PAGE_COMPONENTS dynamically? I maintain an in-house installer for add-on art tools (3ds Max plugins, Photoshop plugins, etc...). I'd like the install options page to open with checkboxes pre-checked for any relevant software programs found on the user's machine (e.g. the "Max 6 Plugins" checkbox would be checked if I found Max6 on the user's HD).

I can find the programs without any problems. I just can't seem to figure out how to pass MUI_PAGE_COMPONENTS any parameters, except for the -o in the section head, that would let me dynamically change the state of the UI widgets.
RobGrant#
You don't want to dynamically change them. In your custom Page function, do the detection FIRST, then before you call your MUI_INSTALLOPTIONS_DISPLAY macro, you set your checkboxes, probably with MUI_INSTALLOPTIONS_WRITE
kichik#
MUI_PAGE_COMPONENTS is not a custom page.

Use the SelectSection and UnselectSection macros from Sections.nsh. For example:
!include Sections.nsh

Section "Photoshop plug-ins" ps_plugins
SectionEnd

Function .onInit
IfFileExsists $PROGRAMFILES\Photoshop\main.exe psins
!insertmacro SelectSection ${ps_plugins}
Goto done
psins:
!insertmacro UnselectSection ${ps_plugins}
done:
FunctionEnd