0

Im trying to create an installer using NSIS, using "installer based on zip file".

I'd like to create a dialog box at the beginning of install that gives the user 2 choices (32, 64), then depending upon the choice they made, to change the path variable ($PROGRAMFILES32 or $PROGRAMFILES64)

Is this possible in NSIS? Are there any example scripts that could get me going?

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
Ke.
  • 333
  • 1
  • 2
  • 8

1 Answers1

1

It's probably a bad idea to leave the choice to the user. I'd use the x64 headers to determine the default directory.

Include this in the header of your script.

!include LogicLib.nsh
!include x64.nsh

Then use this in the script, e.g. in the .onInit function:

${If} ${RunningX64}
    # 64 bit code
${Else}
    # 32 bit code
${EndIf}

Since you can't create a simple MessageBox with custom buttons, I'd suggest you create a dialog page with radio-buttons using nsDialogs. The If statement would then go to the leave function (see the control state example), querying the value of ${NSD_GetState}.

idleberg
  • 1,342
  • 1
  • 11
  • 17
  • In this case though I dont have a choice, because I'm installing these files into a piece of software that already exists. The user might have installed the 32 or 64 bit version (they can have either, or both if they have a 64 bit computer). Any idea how to make the if/else switch work with a dialog box? – Ke. Oct 12 '14 at 07:41
  • See my edited answer – idleberg Oct 12 '14 at 08:43