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

Inno Setup Download file from location based on user input

我想知道如何将输入从 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;

感谢建议和帮助

仅在下载开始之前调用 idpAddFile,从 NextButtonClick(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;