Archive: InstallOptions checkboxes


InstallOptions checkboxes
Hi,

I'm having some problems with using the InstallOptions plugin. I am using Modern UI and have created my own custom finish page. It has some text, and a checkbox allowing the user to choose to open the program straight away, just as the default finish page does. In that page's ini file I have:

[Field 2]
Type=CheckBox
Left=0
Right=-1
Top=25
Bottom=46
Text=I want to run the program now.
State=1

In my program's nsi file, I have the finish page's leave function as:

Function LeaveFinishPage
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "Finish Page.ini" "Field 2" "State"
StrCmp $R0 "1" 0 +2
ExecShell "open" "program.exe"
FunctionEnd

The page itself comes up fine. The problem is, sometimes the program will not open when the installer is closed, even if the user doesn't touch the checkbox (which, of course, is on to begin with). I can't seem to find a pattern as to when this happens. Quite simply, sometimes it'll work, sometimes it won't.

I've thought maybe I need to push and/or pop $R0 before and/or after, but it hasn't made a difference (don't really understand the push/pop commands, anyway).

Am I missing something? I've looked in Modern.nsh, and it's done there in the same way.

Regards,
Brad.

Try this before showing the page:

!insertmacroMUI_INSTALLOPTIONS_WRITE"FinishPage.ini""Field2""State""0"

So will prevent that to happen.

Thanks for your help! :)