kadijsha
22nd August 2006 10:02 UTC
check values in if/else
Hello,
I have a problem in performing an if/else with two variables. I´m new in this and I don´t how to this.
Here´s my code. I read the values of the two variables $Play and $Install, both are checkboxes. If nothing is selected a message box should appear. If $Play is selected the installer quit and the game will be started. If $Install is selected I will continue with the installer.
!insertmacro MUI_INSTALLOPTIONS_READ $Play "test.ini" "Field 4" "State"
>!insertmacro MUI_INSTALLOPTIONS_READ $Install "test.ini" "Field 5" "State"
>${If} $Play == 0 && $Install == 0
# message box appears
>MessageBox MB_OK "Please select...!"
>${Else} {If} $Play == 1
# start game and quit installer
>Exec "test.exe"
Quit
#${Else}{If}$Install == 1
# go to next page installer?????
${EndIf}
Can you please help me with this if/else. How can I ask for values of two variables, I can´t use "&&". I don´t know how to do. What command can I use to continue with the installer.
Thank you very much.
Filus
22nd August 2006 12:34 UTC
Try:
${If} $Play == 0
${AndIf} $Install == 0
# message box appears
MessageBox MB_OK "Please select...!"
${ElseIf} $Play == 1
# start game and quit installer
Exec "test.exe"
Quit
${EndIf}
kadijsha
22nd August 2006 13:34 UTC
I´ve tried this and it works. Thanks. But I have another question. If the user don´t make a choice the message box appears. Now the user press the ok button and the next page of the installer appears. How can I stay on the first side so that the user can make his choice???
Comperio
22nd August 2006 16:07 UTC
You need to add an abort call right after your message box call.
kadijsha
22nd August 2006 17:04 UTC
How can I do an abort call? I´m not familiar enough with this syntax. Could you please help me?
Comperio
23rd August 2006 00:06 UTC
See in blue below:
${If} $Play == 0
${AndIf} $Install == 0
# message box appears
MessageBox MB_OK "Please select...!"
abort
${ElseIf} $Play == 1
# start game and quit installer
Exec "test.exe"
Quit
${EndIf}
This is examplained in the help files,
Section 4.5.3:
The leave-function allows you to force the user to stay on the current page using Abort
kadijsha
23rd August 2006 11:19 UTC
Thank you very much for your help. Now it works and I can finish.
Kadijsha