Reputation: 6565
I know this question was asked before with almost the same title. But the answere doesn't provides me with enough informations to solve the problem. Also my problem seams to be a little bit different.
I am using the Inno Download Plugin
My Source looks like
[Components]
Name: "dl"; Description: "{cm:DLMessage}"; Types: full fullService
Name: "dl\aaa"; Description: "aaa111"; Types: full fullService;
Name: "dl\bbb"; Description: "bbb222"; Types: full fullService;
Name: "dl\ccc"; Description: "ccc333"; Types: full fullService;
[Code]
procedure InitializeWizard();
begin
idpAddFileComp('ftp://user:[email protected]/folder/myFile1.exe', ExpandConstant('{app}\subfolder\Download\myFile1.exe'), 'dl\aaa');
idpAddFileComp('ftp://user:[email protected]/folder/myFile2.exe', ExpandConstant('{app}\subfolder\Download\myFile2.exe'), 'dl\bbb');
idpAddFileComp('ftp://user:[email protected]/folder/myFile3.exe', ExpandConstant('{app}\subfolder\Download\myFile3.exe'), 'dl\ccc');
idpDownloadAfter(wpReady);
end;
What I want to achieve is to download some files depending on the selection that was made with the components.
Since im relative new to inno... the answere
Prototype:
function WizardDirValue: String;
says the same to me like if you try tell a dentist how to repair a car :)
I want to use {app}
in the InitializeWizard but I don't have a clou how, even with that given "hint". Anyone can explain this to me ? (Google didn't really helped me)
Upvotes: 3
Views: 4463
Reputation: 76683
The InitializeWizard
event method is triggered right after the wizard form is created, so it is too soon to pass the {app}
directory to the plugin (the WizardDirValue
function would do the same), because the user haven't passed the directory input page. You will need to move your code into an event which is triggered after the user selects the directory.
Try something like this instead:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
procedure InitializeWizard;
begin
// only tell the plugin when we want to start downloading
idpDownloadAfter(wpReady);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
// if the user just reached the ready page, then...
if CurPageID = wpReady then
begin
// because the user can move back and forth in the wizard, this code branch can
// be executed multiple times, so we need to clear the file list first
idpClearFiles;
// and add the files to the list; at this time, the {app} directory is known
idpAddFileComp('ftp://user:[email protected]/folder/myFile1.exe', ExpandConstant('{app}\subfolder\Download\myFile1.exe'), 'dl\aaa');
idpAddFileComp('ftp://user:[email protected]/folder/myFile2.exe', ExpandConstant('{app}\subfolder\Download\myFile2.exe'), 'dl\bbb');
idpAddFileComp('ftp://user:[email protected]/folder/myFile3.exe', ExpandConstant('{app}\subfolder\Download\myFile3.exe'), 'dl\ccc');
end;
end;
Upvotes: 4