Archive: Skip custom page based on check button state


Skip custom page based on check button state
I have read various threads on skipping a custom page based on a user selection, but cannot get it to work.

I want to skip custom page B if the user does not check a check box in custom page A. Where ever I put the abort in the funtion it seems to skip page B.

Any help appreciated.

Installer copied below. Thanks.

!define PRODUCT_NAME "xxxx"
!define PRODUCT_VERSION "2.0"
!define PRODUCT_PUBLISHER "XXX"
!define PRODUCT_WEB_SITE "XXXXXX"
!define MUI_ABORTWARNING
!define MUI_ICON "xxxx.ico"


!include "MUI.nsh"
!include "LogicLib.nsh"


; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "C:XXXX.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
Page custom CustomPageA
Page custom CustomPageB
;Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
;--------------------------------

; Language files
!insertmacro MUI_LANGUAGE "English"
;--------------------------------


ReserveFile "ioA.ini"
ReserveFile "ioB.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS


Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "XXX_2_0.exe"
InstallDir "$PROGRAMFILES\XXX"
;InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails hide

Section "MainSection" SEC01
;Read a value from an InstallOptions INI file
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "ioA.ini" "Field 2" "State" ;"IP"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ioA.ini" "Field 4" "State" ;"X"
!insertmacro MUI_INSTALLOPTIONS_READ $R2 "ioA.ini" "Field 5" "State" ;
!insertmacro MUI_INSTALLOPTIONS_READ $R3 "ioA.ini" "Field 7" "State" ;
!insertmacro MUI_INSTALLOPTIONS_READ $R9 "ioA.ini" "Field 8" "State" ;query install wake on lan feature
!insertmacro MUI_INSTALLOPTIONS_READ $R5 "ioB.ini" "Field 2" "State" ;
!insertmacro MUI_INSTALLOPTIONS_READ $R8 "ioB.ini" "Field 4" "State" ;
!insertmacro MUI_INSTALLOPTIONS_READ $R7 "ioB.ini" "Field 6" "State" ;for ip address

SectionEnd

Section -Post
SectionEnd


section -mapped_drive
sectionend

section -write_csv_file
sectionend

;Installer Functions

Function .onInit

;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
FunctionEnd

LangString TEXT_IO_TITLE ${LANG_ENGLISH} "XXXX System Set Up"
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This Page will set up"

Function CustomPageA

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"

FunctionEnd

Function CustomPageB
${If} $R9 = 0
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "Please enter description"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"

FunctionEnd


try


${If} $R9 == 0
Abort
${EndIf}

Function CustomPageB
!insertmacro MUI_INSTALLOPTIONS_READ $R9 "ioA.ini" "Field 8" "State"
${If} $R9 = 0
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "Please enter description"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"

FunctionEnd

Thank you, Thank you.

That did the trick.