Skip to content
⌘ NSIS Forum Archive

Problem on LeaveCustom function

7 posts

sunlight112#

Problem on LeaveCustom function

I am working on my installer but now I have some problem which I can not repair it.
I hope somebody know please help me!!
My code here:

Function LeaveCustom

ReadINIStr $0 $INI "Settings" "State"
MessageBox MB_OK "value : $0"

StrCmp $0 1 JDK End
StrCmp $0 2 MySQL End

JDK:
SetOutPath $PLUGINSDIR
File "e:\java.exe"
ExecShell '' "$PLUGINSDIR\java.exe" ''

ReadINIStr $1 $INI "Field 1" "HWND"
EnableWindow $1 0

ReadINIStr $1 $INI "Field 2" "HWND"
EnableWindow $1 1
Abort ;return to the page
MySQL:
SetOutPath $PLUGINSDIR
File "e:\mysql.exe"
ExecShell '' "$PLUGINSDIR\mysql.exe" ''

ReadINIStr $1 $INI "Field 2" "HWND"
EnableWindow $1 0

ReadINIStr $1 $INI "Field 3" "HWND"
EnableWindow $1 1
; Abort
End:
FunctionEnd
I want to create a menu like this:
--------------------
| Java |
--------------------
| MySql |
--------------------
| View ReadMe|Exit |
--------------------
When java is installed, button "java" is diable and "mysql" is enable. My problem is here. When I click on mysql to install it my application exit.
MessageBox MB_OK "Value : $0"
I use to detect MYSQL is click or not.
Although Value: 2 is displayed but my application still exit.
If someone use to see this problem, please help me!!!!
Thank a million!!!!
sunlight112#
Yes, $INI is file ini (menu.ini) which I put it to help me
easily use.

Var INI
.....
File /oname = $INI "menu.ini"
....
Animaether#
Maybe I'm misreading things, but...

This works fine, and shows the correct value (2) for the MySQL button, right?

Function LeaveCustom
ReadINIStr $0 $INI "Settings" "State"
MessageBox MB_OK "value : $0"
Then you perform the following checks

StrCmp $0 1 JDK End
StrCmp $0 2 MySQL End
Note that this means:
"If the value of $0 is 0, then to to the 'JDK' label, otherwise go to the 'End' label."
What you want is for it to simply continue to the next comparison?

So you should use:

StrCmp $0 1 JDK
StrCmp $0 2 MySQL
goto End
Then the next problem would still be here:

MySQL:
; code here
; Abort
End:
FunctionEnd
You would need to -un-comment the Abort call, otherwise it will still continue with the next page/exit.