Archive: ReadINIStr problem


ReadINIStr problem
I have a very simple call in a section. My ini file is a custom page, displayed earlier in the install. Field 2 is a radio button, flags set to group (there are two rbuttons). When selected, the state should be 1:

ReadINIStr $3 "CustomPageINI.ini" "Field 2" "State"
StrCmp $3 "1" 0 +2
Call MyFunction

;Do some other stuff

If selected, MyFunction does not get called. What am I missing here?


Specify a full path for the INI file or use the MUI macro if you have used another MUI macro to extract the INI.


I've basically modified the the IO example script. So, I'm using

ReserveFile "Myini.ini" ;doesn't this extract? To where? $INSTDIR?

Using that statement, what path would I use with the ReadINIStr call?


As Joost said: "ReserveFile only changes the position of a file in the datablock."

If the page shows and you haven't used File then you have probably used the MUI macro MUI_INSTALLOPTIONS_EXTRACT. Therefore you have to use the MUI macro to read too as the example shows:

!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "ioC.ini" "Field 2" "State"
StrCmp ${TEMP} "1" "" +2
;Checked
MessageBox MB_OK "A MessageBox..."

So, if I commit to the MUI_* macros in the beginning, then I have to stick with them?

That worked, by the way. Thanks so much for your time. I think I'd really enjoy this installer if I wasn't such an MFC hack.


You don't have to but it's recommended. The macros put the INI file in $PLUGINSDIR which is an automatically generated temporary directory that is also automatically deleted when the installer quits.


Cool. Thanks.