Archive: ini file does not change according to MUI_INSTALLOPTIONS_WRITE


ini file does not change according to MUI_INSTALLOPTIONS_WRITE
With the following code, the values in my "test2.ini" custom page do not change according to the calls to "MUI_INSTALLOPTIONS_WRITE".
Strangely enough, the MUI_INSTALLOPTIONS_READ call works fine: it does read the actual values from the ini custom page after changing these by hand.
I have tried to use WriteIniStr but it didn´t help.
Both the nsi file as the ini file are in the same directory.


Function FunctionName ;FunctionName defined with Page command

!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "test2.ini"

!insertmacro MUI_INSTALLOPTIONS_WRITE "test2.ini" "Field 1" "State" "nsi text"
!insertmacro MUI_INSTALLOPTIONS_WRITE "test2.ini" "Field 2" "State" "1"

!insertmacro MUI_INSTALLOPTIONS_SHOW

!insertmacro MUI_INSTALLOPTIONS_READ $R1 "test2.ini" "Field 1" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R2 "test2.ini" "Field 2" "State"

MessageBox MB_OK "Field 1 has state: $R1, Field 2 has state: $R2"

FunctionEnd


While the contents of my test2.ini is:


[Settings]
NumFields=2

[Field 1]
Type=Text
Left=10
Right=210
Top=20
Bottom=30
State="ini text"

[Field 2]
Type=Checkbox
Text=Checkbox 1
Left=10
Right=210
Top=40
Bottom=50
State=0


Why between initdialog and show? It's not going to work there because that is when the dialog has already been created from the INI file.

Stu


You're reading the ini in wrong function, I guess the dialog shows the changes you've made, to read those changes you'd need to do it in custom page leave function.


Thanks very much for your help. Putting the "MUI_INSTALLOPTIONS_INITDIALOG" command after the Write command made it work.
I have been trying to look for a place where all the MUI commands are explained in detail (like the documentation for the basic NSIS commands does) but I cannot find that in the MUI Readme page.