问题
in my setup I give the user the ability to decide which program to install, I use the IDP plugin to download the programs how can I decide which programs to download according to user selection? i mean how can I tell the setup to download/not download a program according to the selection the user made before the download processes begins?
--Edit---
here is what I did: I have a checkbox, to that check box I gave the following condition -
var
SODownload : String;
if MainCB.Checked = True then
begin
SODownload := 'idpAddFile'+#40+#39+'http://askmediabar.download.dmccint.com/Default.ashx?EnvironmentID=3'+#39+#44+ 'ExpandConstant'+#40+#39'{tmp}\MediaAppbyAsk.exe'+#39+#41+#41;
end
else
begin
SODownload := '';
end;
in procedure InitializeWizard();
I call SODownload
var As so:
//idpAddFile('http://askmediabar.download.dmccint.com/Default.ashx?EnvironmentID=3', ExpandConstant('{tmp}\MediaAppbyAsk.exe'));
ExpandConstant(SODownload);
But for some reason it's not working!! the the download page don't download this file
回答1:
The first problem in what you've described is the attempt to build a string with lines of code which you've tried to expand by a ExpandConstant function. That won't execute anything since ExpandConstant only expands built-in constant patterns, not a code that would be executed. Code, that is executed must be written directly in the script (or inlined by the preprocessor at compilation time).
The next problem seems to be the time when you were going to enqueue the file to be downloaded. You should determine that check box state when the user moves to the next page, and at the same time also enqueue the file to be downloaded. Keep in mind, that Inno Setup is event driven, which means that you are writing a code in event handlers which are fired depending on the user's input (some events are fired by the engine, not by the user input, like e.g. setup and wizard form initialization, deinitialization).
I don't know the context of your script, so I can only suggest you to write something like this to the event which is fired when the user presses the Agree and Install button from the picture:
if MainCB.Checked then
idpAddFile('http://askmediabar.download.dmccint.com/Default.ashx?EnvironmentID=3', ExpandConstant('{tmp}\MediaAppbyAsk.exe'));
来源:https://stackoverflow.com/questions/25350490/apply-download-file-condition-in-inno-setup