Archive: Custom Page


Custom Page
Hi, I made a custom page and it works so far. My problem: At the custom page are two options. One to install and one to update. I want if one of them is marked install.nsh or update.nsh will be included. The .nsi file should only contain this lines. But i don´t become it working. Can you say me how i get it working? I hope you can understand my miserable English ^^

Name "Miranda SE 1.65"

# Included files
!include MUI.nsh

# Installer pages
!insertmacro MUI_PAGE_WELCOME
Page custom cp1

Section Fields
ReadINIStr $R0 "cp1.ini" "Field 5" "State"
StrCmp $R0 1 +2
!include update.nsh

ReadINIStr $R0 "cp1.ini" "Field 6" "State"
StrCmp $R0 1 +2
!include install.nsh
SectionEnd

Function .onInit
InitPluginsDir
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "cp1.ini"
FunctionEnd

Function cp1 ;FunctionName defined with Page command
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "cp1.ini"
FunctionEnd

!include is a compile-time command. It will always run so long as the !if*'s around it evaluate to true. What you want is two macros or functions and to invoke the correct one depending on the selection.


You can't include a header at runtime.

edit:
we're posting coinstantaneously with goldy, sorry :)


Originally posted by Red Wine
You can't include a header at runtime.
OK. I deleted it.

Originally posted by goldy1064
What you want is two macros or functions and to invoke the correct one depending on the selection.
What for macros or functions? Sorry, i don´t understand :(

Also, you may add the code straight to your section e.g.

!include "LogicLib.nsh"

Section Fields
# If fields 5 & 6 are two radio buttons
# only one may be selected, so the code is:

ReadINIStr $R0 "cp1.ini" "Field 5" "State"
${If} $R0 == 1
# add here the code from update.nsh
${Else}
# add here the code from install.nsh
${EndIf}
SectionEnd

Thanks thanks thanks! :)