Skip to content
⌘ NSIS Forum Archive

Check Registry before check mark is activated

4 posts

Fstreit#

Check Registry before check mark is activated

Hi

I have an installation that includes 4 different components. These components can be choosen in the components page. Now I'd like to have a check for all components if they are already insatalled. if one of the is already installed the check mark in the components page shouldn't be activated.
I can do the check of the registry by using ReadRegStr ....
but I don't know how to but it into mybe an if-condition and how to connect it to the components page.
Please help me

regards

Fstreit
kichik#
Use the macros from Includes\Sections.nsh to modify components selection and flags. Use SelectSection and UnselectSection for your specific needs.
Red Wine#
Here's a snippet to start with,
OutFile "test.exe"
ShowInstDetails show

Page components components_pre
page instfiles

!include "Sections.nsh"
!include "logiclib.nsh"

Section "Example 1 (checking NSIS)" sec1
DetailPrint "Executing only if NSIS is missing (sec1)"
SectionEnd

Section "Example 2 (Some other stuff)" sec2
DetailPrint "Some other stuff (sec2)"
SectionEnd

Section "Example 3 (Another section)" sec3
DetailPrint "Another section (sec3)"
SectionEnd

Function components_pre
ReadRegStr $R0 HKLM "Software\NSIS" ""
${Unless} ${Errors}
!insertmacro UnSelectSection ${sec1}
SectionSetText ${sec1} ""
${EndUnless}
FunctionEnd