[Setup]
AppName=My Program
AppVersion=1.0
CreateAppDir=no
[Files]
; the parameter passed to the GetDir function here is the index of a directory
; input page item, so the following 3 files will be installed each into one of
; the directories specified in the input page items
Source: "G:\Project\file1.txt"; DestDir: "{code:GetDir|0}"; Components: comp1 comp2
Source: "G:\Project\file2.txt"; DestDir: "{code:GetDir|1}"; Components: comp1
Source: "G:\Project\file3.txt"; DestDir: "{code:GetDir|2}"; Components: comp2
[Types]
Name: "complete"; Description: "complete"
Name: "custom"; Description: "custom"; Flags: iscustom
[Components]
Name: "comp1"; Description: "comp1"; Types: complete custom
Name: "comp2"; Description: "comp2"; Types: complete
[Code]
var
DirPage: TInputDirWizardPage;
function GetDir(Param: String): String;
begin
Result := DirPage.Values[StrToInt(Param)];
end;
procedure InitializeWizard;
begin
// create a directory input page
DirPage := CreateInputDirPage(wpSelectComponents , 'Caption', 'Description', 'SubCaption', False, '');
// add directory input page items
DirPage.Add('Dossier Composant 1');
DirPage.Add('Dossier Composant 2');
DirPage.Add('Dossier Composant 3');
// assign default directories for the items from the previously stored data; if
// there are no data stored from the previous installation, use default folders
// of your choice
DirPage.Values[0] := GetPreviousData('Directory1', 'Selection Dossier 1');
DirPage.Values[1] := GetPreviousData('Directory2', 'Selection Dossier 2');
DirPage.Values[2] := GetPreviousData('Directory3', 'Selection Dossier 3');
end;
procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
// store chosen directories for the next run of the setup
SetPreviousData(PreviousDataKey, 'Directory1', DirPage.Values[0]);
SetPreviousData(PreviousDataKey, 'Directory2', DirPage.Values[1]);
SetPreviousData(PreviousDataKey, 'Directory3', DirPage.Values[2]);
end;
Partager