Reputation: 85
I'm trying to make installer for my program. It uses Mysql and I want to offer user to install it. How can I do it by NSIS ?
Here my installing script
OutFile "setup.exe"
InstallDir $PROGRAMFILES\MYApp\
Page directory
Page instfiles
Section ""
SetOutPath $INSTDIR\MYApp
File C:\ForSetup\*.*
SectionEnd
Upvotes: 0
Views: 526
Reputation: 101666
Use nsDialogs or InstallOptions to create custom pages:
!include LogicLib.nsh
!include nsDialogs.nsh
!include Sections.nsh
Page Custom MyPageCreate MyPageLeave
Page InstFiles
Section "Foo v1.2.3.4" SID_INSTALLFOO
MessageBox mb_ok "Installing Foo"
SectionEnd
Var MyCheckboxHandle
Function MyPageCreate
nsDialogs::Create 1018
Pop $0 ; $0 is "error" if there was a problem
${NSD_CreateLabel} 10u 10u 100% 12u "Hello world, blah blah blah blah?"
Pop $0
${NSD_CreateCheckBox} 15u 30u 50% 12u "Install Foo v1.2.3.4"
Pop $MyCheckboxHandle
${NSD_Check} $MyCheckboxHandle
nsDialogs::Show
FunctionEnd
Function MyPageLeave
${NSD_GetState} $MyCheckboxHandle $0
${If} $0 <> 0
!insertmacro SelectSection ${SID_INSTALLFOO}
${Else}
!insertmacro UnselectSection ${SID_INSTALLFOO}
${EndIf}
FunctionEnd
Upvotes: 1
Reputation: 85
Section ""
SetOutPath $INSTDIR\MYApp
File C:\ForSetup\*.*
MessageBox MB_YESNO "Mysql is required. Do you want to install it ?" /SD IDYES IDNO endWork
ExecWait '"$SYSDIR\msiExec" /i "mysql-installer-web-community-5.6.22.0.msi"'
endWork:
; the end
SectionEnd
Upvotes: 0