kadijsha
3rd August 2006 16:02 UTC
Custom Page Status of RadioButtons
Hello,
I´ve started working with NSIS yesterday and I now have a problem. I hope you can help me. I think it´s just a little problem for you.
Okay, I´ve created a custom page on which are two radiobuttons:
1 --> user start the program on cd and the setup should close (exec, abort?)
2 --> setup continues and install the program
LangString TEXT_IO_TITLE${LANG_ENGLISH} "Install and Play Options Page "
>LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "A subtitle"
>Page custom OwnPage ValidateCustom
>Function OwnPage ;FunctionName defined with Page command
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
# display page
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "test.ini"
# Get the user entered values.
!insertmacro MUI_INSTALLOPTIONS_READ $Play "test.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Install "fridolin.ini" "Field 5" "State"
>FunctionEnd
>Function ValidateCustom
ReadINIStr $Play "test.ini" "Field 4" "State"
ReadINIStr $Play "test.ini" "Field 5" "State"
>FunctionEnd
>
Now I don´t know how I can check which one is checked. Is it ok to do this with ReadINIStr? And how can I now define what happens.
Thank you so much. Kadijsha
Afrow UK
3rd August 2006 16:18 UTC
1. Read the values in the Leave function only (ValidateCustom).
2. Use MUI_INSTALLOPTIONS_READ not ReadINIStr.
-Stu
kadijsha
3rd August 2006 16:34 UTC
OK. I´ll do it like this. But how can I make an if/else to check which one is checked and to perform both actions? Can you help me?
kichik
3rd August 2006 18:41 UTC
!include LogicLib.nsh
#...
${If} $Play == 1
# do something...
${Else}
# do something else...
${EndIf}
kadijsha
3rd August 2006 19:10 UTC
Thank you very much for your post. I didn´t find anything before.
I´ve done this and now I get the following error:
"OwnPage"
>!insertmacro: MUI_HEADER_TEXT
>!insertmacro: end of MUI_HEADER_TEXT
>!insertmacro: MUI_INSTALLOPTIONS_DISPLAY
>!insertmacro: end of MUI_INSTALLOPTIONS_DISPLAY
FunctionEnd
>Function: "ValidateCustom"
>!insertmacro: MUI_INSTALLOPTIONS_READ
Usage
: ReadINIStr $(user_var: output) ini_file section entry_name
Error in macro MUI_INSTALLOPTIONS_READ on macroline 5
Error in script"C:\Dokumente und Einstellungen\Administrator\Desktop\installer2\fridolin\fridolin\fridolin.nsi" on line 68 -- aborting creation process
>
I did it like this.
ValidateCustom
!insertmacro MUI_INSTALLOPTIONS_READ $Play "test.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Install "test.ini" "Field 5" "State"
${If} $Play == 1
# do something...
Exec "$INSTDIR\test.exe"
Quit
;${Else}
# do something else...
${EndIf}
>FunctionEnd
>
kichik
3rd August 2006 19:22 UTC
Are you sure $Play and $Install are defined?
Afrow UK
3rd August 2006 19:31 UTC
With Var that is.
Var Play
Var Install
-Stu
kadijsha
3rd August 2006 19:46 UTC
I thought that the variables will be defined by this. Do I have to define the variables at the beginning of the nsi-file?
In this way: var play, var install?
I will try it. Thanks
kadijsha
3rd August 2006 19:55 UTC
You are right, now it works. Thank you very much ;-))
But I have another question:
I create a shortcut in the startmenu and on the desktop. How can I create this in the startmenu of AllUsers not only in the startmenu of the current user? I´ve tried to find something about this in the manual and in the internet.
kichik
3rd August 2006 19:58 UTC
SetShellVarContext all
kadijsha
3rd August 2006 20:56 UTC
Thanks for the help. Now it works ;-)
Bye Kadijsha