2

I have 4 programs that I'd like to package into one installer and allow the user to select which one they would like to install.

I've never used NSIS before but I was recommended to give it a shot, however, I've no idea where to begin with this.

Basically I just need one page that asks the user to select a radio button then click next to install one of the following programs:

-- Install components --------------------

Select a program from the list below and
click Next to continue.

O Program 1
O Program 2
O Program 3
O Program 4


-------------------------------------------

Cancel                                 Next

Then depending on what they choose it launches program1_setup.exe or program2_setup.exe etc.

As each of my 4 programs are installers in their own right, I take it I don't need to set up the uninstall script in NSIS as that's taken care of already?

Thanks, Greg.

3
  • Why not let the user install more than one program at the time?
    – Anders
    Sep 4, 2012 at 20:15
  • No reason, how would you change the code so that it installs every app they've chosen?
    – gfyans
    Sep 6, 2012 at 8:15
  • By not using radio buttons, just checkboxes (aka not using the stuff from one-section)
    – Anders
    Sep 6, 2012 at 17:30

1 Answer 1

3

This code is similar to the one-section.nsi example.

...

!include sections.nsh

Page components
Page instfiles

Section /o "Program 1" P1
File "/oname=$pluginsdir\Setup.exe" "myfiles\Setup1.exe"
SectionEnd

Section "Program 2" P2
File "/oname=$pluginsdir\Setup.exe" "myfiles\Setup2.exe"
SectionEnd

Section ; Hidden section that runs the show
DetailPrint "Installing selected application..."
SetDetailsPrint none
ExecWait '"$pluginsdir\Setup.exe"'
SetDetailsPrint lastused
SectionEnd

Function .onInit
Initpluginsdir ; Make sure $pluginsdir exists
StrCpy $1 ${P2} ;The default
FunctionEnd

Function .onSelChange
!insertmacro StartRadioButtons $1
    !insertmacro RadioButton ${P1}
    !insertmacro RadioButton ${P2}
!insertmacro EndRadioButtons
FunctionEnd

You can use the CheckBitmap attribute to change the checkbox icons if you want...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.