Inno Setup根据用户输入从位置下载文件

时间:2017-08-03 07:29:29

标签: inno-setup pascalscript inno-download-plugin

我想知道如何将UserPage的输入发送到idpAddFile,以便Inno Download Plugin下载。下载后我想使用该zip并安装应用程序。

现在我有了这个:

var
  UserPage: TInputQueryWizardPage;

procedure InitializeWizard;
begin
  {Page for input Version}
  UserPage := CreateInputQueryPage(wpWelcome,
    'Number of Version', 'example : 1.8.20',
    'Program will download your input');
  UserPage.Add('Version:', False);
  UserPage.Values[0] := GetPreviousData('Version', '1.8.20');

  {Download file from input}
  idpAddFile(
    '127.0.0.1/repository/GU/my-apps/app.zip/{input}/ia-client.zip-{input}.zip',
    ExpandConstant('{tmp}\{input}.zip}'));
  idpDownloadAfter(wpReady);
end;

感谢您的建议和帮助

1 个答案:

答案 0 :(得分:0)

仅在下载开始之前调用idpAddFileNextButtonClick(wpReady),当您已经知道版本且用户无法再更改它时

function NextButtonClick(CurPageID: Integer): Boolean;
var
  Version: string;
  FileURL: string;
begin
  if CurPageID = wpReady then
  begin
    Version := UserPage.Values[0];
    FileURL := Format('http://www.example.com/path/%s/app-%0:s.zip', [Version]); 
    idpAddFile(FileURL, ExpandConstant(Format('{tmp}\app-%s.zip', [Version])));
  end;
  Result := True;
end;