【问题标题】:Inno Setup Download file from location based on user inputInno Setup 根据用户输入从位置下载文件
【发布时间】:2017-08-03 07:29:28
【问题描述】:

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

感谢您的建议和帮助

【问题讨论】:

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


    【解决方案1】:

    仅在下载开始之前从NextButtonClick(wpReady) 调用idpAddFile,此时您已经知道版本并且用户没有机会再更改它:

    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;
    

    【讨论】:

    • 感谢 Martin 的回答,我将您的代码粘贴在上面。但是单击下一步后没有任何反应,我更改了 http 地址。可能是一些标识符错误?感谢您的建议
    • 您已删除idpDownloadAfter(wpReady);。它必须保持在原来的位置。
    • 谢谢 :) 我希望最后一个问题 :) 如何 idpAddFille 发送输入?在上面的代码中,我粘贴了问题。
    • 我的回答表明! URL 中的 %s%0:s 被用户输入替换 - 您可以对 '{tmp}\app.zip' 使用相同的技术 - 已编辑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多