此代码实际上下载了我的文件,并且所选组件是否为“ test”都无关紧要。我要下载这两个文件,如果您选择一个组件,可以这样做吗?我使用Inno Inno Setup 5 + Tools Downloader)
[Components]
Name: Dictionaries; Description: "test"; Types: Full; ExtraDiskSpaceRequired: 50;
[Languages]
Name: english; MessagesFile: compiler:Default.isl
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','');
[Code]
procedure InitializeWizard();
begin
itd_init;
itd_addfile('http://www.sherlocksoftware.org/petz/files/dogz5.zip',expandconstant('{tmp}\dogz5.zip'));
itd_addfile('http://www.sherlocksoftware.org/petz/files/petz4.zip',expandconstant('{tmp}\petz4.zip'));
itd_downloadafter(wpReady);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin
filecopy(expandconstant('{tmp}\dogz5.zip'),expandconstant('{app}\dogz5.zip'),false);
filecopy(expandconstant('{tmp}\petz4.zip'),expandconstant('{app}\petz4.zip'),false);
end;
end;
是的,那是可能的。您正在寻找一个名为IsComponentSelected()的辅助函数。
从本质上讲,它是一个布尔测试器,它name
从中接受组件[components]
并返回复选框值(selected = true)。
// for a single component
if IsComponentSelected('NameOfTheComponent') then idpAddFile(URL, ...);`
// multiple components with one selection
if IsComponentSelected('dictionaries') then
begin
idpAddFile(URL1, ...);
idpAddFile(URL2, ...);
end;
TLama评论:
在哪种情况下以及在何处使下载文件入队?
我建议将NextButtonClick
事件与条件一起使用,即当前(CurPage
)必须是组件选择屏幕(wpSelectComponents
)。换句话说:当您在组件选择屏幕上并按下一步时,仅所选组件被添加到下载器中。
代码看起来像这样:
function NextButtonClick(CurPage: Integer): Boolean;
(*
Called when the user clicks the Next button.
If you return True, the wizard will move to the next page.
If you return False, it will remain on the current page (specified by CurPageID).
*)
begin
if CurPage = wpSelectComponents then
begin
if IsComponentSelected('NameOfTheComponent') then idpAddFile(URL, ...);
end; // of wpSelectComponents
Result := True;
end;
旁注:您可以将下载库切换到https://code.google.com/p/inno-download-plugin/。它具有更好的功能,包括不错的https支持,并且会得到积极维护。SherlockSoftware下载的InnoTools已过时(2008)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句