Archive: Multiple custom pages


Multiple custom pages
I need little help, i dunno where to start with having the install button (changed it to next) to goto next custom page (i would like to have about 4 custom pages that just ask information and then goto next page) and at the end i will produce a new script i have done this before with just one custom page now i would like to make it multiple pages (for size and organization reasons)

i would like to just use the normal UI but any help would be helpful.


Single Custom Page Example
Here is my single custom page example and now i would like instead of quitting for it to head to custompage #2


!include WinMessages.nsh
Name "custompage Test"
OutFile "CustomPages.exe"
SetCompressor /FINAL bzip2

ShowInstDetails show

Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\test.ini "testnotify.ini"
FunctionEnd

Page custom ShowCustom LeaveCustom ""

Function ShowCustom
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\test.ini"
Pop $0
InstallOptions::show
Pop $0
FunctionEnd

Function LeaveCustom
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Settings" "State"
StrCmp $0 0 next
StrCmp $0 13 clear
Abort

clear:
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 2" "HWND"
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 3" "HWND"
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 5" "HWND"
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
Abort

next:
ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 2" "State" ;Camapaign ID
ReadINIStr $R1 "$PLUGINSDIR\test.ini" "Field 4" "State" ;Application Name
ReadINIStr $R2 "$PLUGINSDIR\test.ini" "Field 6" "State" ;Skin Name
ReadINIStr $R3 "$PLUGINSDIR\test.ini" "Field 8" "State" ;http Location
ReadINIStr $R4 "$PLUGINSDIR\test.ini" "Field 10" "State" ;Script File
ReadINIStr $R5 "$PLUGINSDIR\test.ini" "Field 12" "State" ;icon File

SetOverwrite try
ExecWait '"C:\Program Files\NSIS\makensis.exe" "/DAPP=$R1" "/DICON=$R5" "/DSKINNAME=$R2" "/DCAMPID=$R0" "/DDOWNLOADDIR=$R3" $R4'
Quit
FunctionEnd

; Installation page
Page instfiles

Section
SectionEnd

I'm not sure I understand the problem. If you want multiple custom pages, use multiple Page commands. Doesn't that work for you?


Yeah i Figured it out
Well i think i figured it out i figured it would be easier then this but it works. Thanks Joost Verburg.


!include "MUI.nsh"
CRCCheck on
Name "Install Creator Test 1.0"
OutFile "CreateInstaller.exe"
InstallDir "$DESKTOP"

;!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
Page custom CustomPageA
Page custom CustomPageB
Page custom CustomPageC
Page custom CustomPageD
!insertmacro MUI_PAGE_INSTFILES

!define MUI_ABORTWARNING

!insertmacro MUI_LANGUAGE "English"

;If you are using solid compression, files that are required before
;the actual installation should be stored first in the data block,
;because this will make your installer start faster.

ReserveFile "custom1.ini"
ReserveFile "custom2.ini"
ReserveFile "custom3.ini"
ReserveFile "custom4.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

Section "Main Installer" Main

SetOutPath "$INSTDIR"

;___________________________________________
;
; Main Page Input
;___________________________________________

; Main page Variables
Var /GLOBAL ScriptName
Var /GLOBAL InstIco
Var /GLOBAL UninstIco
Var /GLOBAL ExeName
Var /GLOBAL Website
Var /GLOBAL WndClass
Var /GLOBAL WndTitle

!insertmacro MUI_INSTALLOPTIONS_READ $ScriptName "custom1.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $InstIco "custom1.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $UninstIco "custom1.ini" "Field 6" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $ExeName "custom1.ini" "Field 8" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Website "custom1.ini" "Field 10" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $WndClass "custom1.ini" "Field 12" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $WndTitle "custom1.ini" "Field 14" "State"

;___________________________________________
;
; File Info Page Input
;___________________________________________

; File Info Variables
Var /GLOBAL ProdName
Var /GLOBAL FileVersion
Var /GLOBAL TradeMark
Var /GLOBAL CopyRight
Var /GLOBAL Comment
Var /GLOBAL Description

!insertmacro MUI_INSTALLOPTIONS_READ $ProdName "custom2.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $FileVersion "custom2.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $TradeMark "custom2.ini" "Field 6" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $CopyRight "custom2.ini" "Field 8" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Comment "custom2.ini" "Field 10" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Description "custom2.ini" "Field 12" "State"

;___________________________________________
;
; Customize Installer Page Input
;___________________________________________

; Installer Custom Variables
Var /GLOBAL Header
Var /GLOBAL LeftImage
Var /GLOBAL BottomImage
Var /GLOBAL BGColor
Var /GLOBAL BText
Var /GLOBAL BFront
Var /GLOBAL BBack
Var /GLOBAL TextColor
Var /GLOBAL TextLightColor

!insertmacro MUI_INSTALLOPTIONS_READ $Header "custom3.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $LeftImage "custom3.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $BottomImage "custom3.ini" "Field 6" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $BGColor "custom3.ini" "Field 8" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $BText "custom3.ini" "Field 10" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $BFront "custom3.ini" "Field 12" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $BBack "custom3.ini" "Field 14" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $TextColor "custom3.ini" "Field 16" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $TextLightColor "custom3.ini" "Field 18" "State"

;___________________________________________
;
; Splash Screen Input
;___________________________________________

Var /GLOBAL Picture
Var /GLOBAL Sound

!insertmacro MUI_INSTALLOPTIONS_READ $Picture "custom4.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Sound "custom4.ini" "Field 4" "State"

;___________________________________________
;
; Installer Creation Point
;___________________________________________

ExecWait '"$EXEDIR\makensis.exe" "/DAPP=$R1" "/DICON=$R5" "/DSKINNAME=$R2" "/DCAMPID=$R0" "/DDOWNLOADDIR=$R3" $ScriptName'

;MessageBox MB_OK "Your website is $Website"

SectionEnd


Function .onInit

;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "custom1.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "custom2.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "custom3.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "custom4.ini"

FunctionEnd

Function CustomPageA

!insertmacro MUI_HEADER_TEXT "Main Page" "The following fields all need to be filled out Carefully for there is no real validation except that you fill them out."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "custom1.ini"

FunctionEnd

Function CustomPageB

!insertmacro MUI_HEADER_TEXT "File Version Properties" "The following fields describe to windows what the application properties are."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "custom2.ini"

FunctionEnd

Function CustomPageC

!insertmacro MUI_HEADER_TEXT "Customize Installer" "the first 3 fields have to be Bitmaps it will not accept anything else. Color Must Be in HEXIDECIMAL format ONLY!. If wish to not have a drop shadow on the branding then put the same color in both fields."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "custom3.ini"

FunctionEnd

Function CustomPageD

!insertmacro MUI_HEADER_TEXT "Splash Screen" "The First field must be a Bitmap and the 2nd field must be a wav or it will not work."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "custom4.ini"

FunctionEnd

BrandingText "Skin Installer Graphical User Interface"

just one more queston
how do i start a page with a variable. I know that the State in the INI will place that string in the textbox. How do i place a variable in there instead like $DESKTOP placed under the state field it will just print out "$DESKTOP" not C:\Document and settings\User\Desktop

thanks
Solwolf


ok so i figured it out. To Start your form with values that are variables. you must just write to the ini prior Initializing your installOptions like this:


WriteINIStr "$PLUGINSDIR\test.ini" "Field 10" "State" "$Desktop"
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\test.ini"

you may also need to put

File /oname=$PLUGINSDIR\installapp.ini "assets\installapp.ini"
so that it works on computers other than the build computer. I think... am prolly wrong :igor: