Prompting for directory install
Hello all,

I got my first script working today. Cross compiling it from Linux!

Pretty chuffed.

I tested it using some of the scripts in the tutorials and examples section of the NSIS documentation.

Having had a quick play I can get my installer to install three things in one go(!). One is an msi for which I use msiexec. The other two are straight forward files.

I want to have the installer prompt for the directory to install the files, but it doesn't make sense to have it prompt for the install location of the msi.

Question: how do I get it to prompt for a directory install, but only after the msi package has been installed.

At the moment the screen that prompts me for an install directory appears very early on.

Where do I put the: !insertmacro MUI_PAGE_DIRECTORY

I've seen posts that will tell me how to specify different install directories for each section. And one post that shows me how to selectively prompt for install location based on whether the section is selected for install. I can't find anything that lets me delay prompting for directory until just before the section is installed.

Any guidance on which bits of the documentation to focus on would be very much appreciated. Any tips at all would gratefully appreciated.


Many thanks in advance.

Greg


The script is:

!include "MUI.nsh"
!include "WinMessages.nsh"

!define PRODUCT_NAME "My Product"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "blah blah"

SetCompressor lzma

; MUI Settings / Icons
!define MUI_ABORTWARNING

;... some icon and header graphics defs..

!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "MySetup.exe"
ShowInstDetails show
InstallDir "$PROGRAMFILES\ProductOne"

Section -SETTINGS
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
SectionEnd

Section "PostgreSQL"
SetOutPath "$INSTDIR"
File "thirdpartypackage.msi"
ExecWait 'msiexec /i "$INSTDIR\thirdpartypackage.msi"
SectionEnd

Section "MyDirTree"
SetOutPath "$INSTDIR"
File /r "./mydirectory"
SectionEnd

Section "MyFileInstance"
SetOutPath "$INSTDIR"
File "./myfile"
SectionEnd