Archive: User defined multiple install directories


User defined multiple install directories
Hi all

I am new to NSIS and am hoping that someone can help me.

I am trying to do the following:

1. Ask the user for 3 different directories, each with a default value set.

2. Be able to copy different files to each directory.

Am I able to define a dynamic folder so that even if the contents change every file in the folder will still be copied. (i.e. I want to copy all files in 1 folder on the source machine into a folder on the target machine)


Thanks in advance
Peter


That can probably be done by using multiple "directory" pages and saving the chosen directory for each in different variables (e.g. $InstDir1, $InstDir2, $InstDir3). Including a whole folder independent of its contents is easy:
File /r "${SOURCE}\*.*"


@ mcvman,
This may give you a clue,

http://nsis.sourceforge.net/Installe..._Installations


That's great guys, i really appreciate the help.

Would anyone like the challenge of mocking up a bit of code to guide me, I am very new to this and would really appreciate a bit of help?


I came up with this, which might be closer to what you're looking for:


OutFile "nsistest.exe"

Var InstDir1
Var InstDir2
Var InstDir3
Var PartName
Name "$PartName"

PageEx directory
PageCallbacks defaultInstDir1 "" getInstDir1
Caption ": Directory 1"
PageExEnd
PageEx directory
PageCallbacks defaultInstDir2 "" getInstDir2
Caption ": Directory 2"
PageExEnd
PageEx directory
PageCallbacks defaultInstDir3 "" getInstDir3
Caption ": Directory 3"
PageExEnd
Page instfiles

Function defaultInstDir1
StrCpy $INSTDIR "C:\temp\1"
StrCpy $PartName "Part 1"
FunctionEnd

Function getInstDir1
StrCpy $InstDir1 $INSTDIR
FunctionEnd

Function defaultInstDir2
StrCpy $INSTDIR "C:\temp\2"
StrCpy $PartName "Part 2"
FunctionEnd

Function getInstDir2
StrCpy $InstDir2 $INSTDIR
FunctionEnd

Function defaultInstDir3
StrCpy $INSTDIR "C:\temp\3"
StrCpy $PartName "Part 3"
FunctionEnd

Function getInstDir3
StrCpy $InstDir3 $INSTDIR
StrCpy $PartName "Test"
FunctionEnd

Function .onInit
StrCpy $PartName "Test"
FunctionEnd

Section
SetOutPath $InstDir1
File /r "1\*.*"
SetOutPath $InstDir2
File /r "2\*.*"
SetOutPath $InstDir3
File /r "3\*.*"
SectionEnd

The above code is really good and is exactly what I'm looking but is there a way to have all the directory selections on the 1 page instead of seperate ones.

Thanks again
Peter


Is there anyonew who can alter the above code so that all directory requests appear on the 1 page?


Hmm.. shoot me if im being misleading, but couldn't you use a custom page with 3 DirRequest elements(named by the HM NIS Edit program with its 'New Install Options file' creator) and then extract the details with a leaving custom page function? Then you don't need to include some of the other standard pages.
But I'm learning how to use the leaving function at the moment, so can't be too clear :(