Archive: Creating an InstallOptions page


Creating an InstallOptions page
I`m trying to create an installation options page. But can`t get it working.

In the same dir as my setup.exe i have a directory 'bin' which contains the 'installoptions.ini' where my page is defined. And i want this .ini to use during my installation.

I did the following:


;------------------------------------------------------------------------------------
; Pages
;------------------------------------------------------------------------------------
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "licence.txt"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Options page
Page custom InstallOptionsPage
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
; Finish page
!insertmacro MUI_PAGE_FINISH


;------------------------------------------------------------------------------------
;Reserve Files
;------------------------------------------------------------------------------------
ReserveFile "bin\installoptions.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS


Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "bin\installoptions.ini"
FunctionEnd


;------------------------------------------------------------------------------------
; Install Options Page
;------------------------------------------------------------------------------------
Function InstallOptionsPage
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "$INSTDIR\bin\installoptions.ini"

FunctionEnd

I get the following error:


Error opening file for writing:

c:\Docume~1\[user]\locals~1\temp\nsrF0.tmp\bin\installoptions.ini

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "installoptions.ini"
The reason for the error is because the folder bin does not exist under $PLUGINSDIR. Also note that as you are using MUI_INSTALLOPTIONS_EXTRACT you do not have to have a copy of installoptions.ini with your setup.exe. MUI_INSTALLOPTIONS_EXTRACT puts the InstallOptions file into the installer.

Stu


Originally posted by Afrow UK
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "installoptions.ini"
When i change this link the compiler cant find the file... Same thing with the other 2 references to the file.

Any other idea?

Whats wrong with this error?

Usage: ReadINIStr $(user_var: output) ini_file section entry_name
Error in script "C:\install.nsi" on line 145 -- aborting creation process



---- install.nsi ----
ReadINIStr ${TEMP1} "$PLUGINSDIR\installoptions.ini" "Field 3" "State"

---- installoptions.ini ----
[Field 3]
Type=Text
State=Text
Left=136
Right=259
Top=44
Bottom=57

If you have different source and destination paths, use the EXTRACT_AS macro. I don't think ${TEMP1} is defined or does not contain a variable.

Stu


Solved: the {temp1} wasn`t devined like u said