2017-08-03 71 views
1

我想知道如何发送输入从UserPageidpAddFile下载Inno Download Plugin。下载后,我想使用该压缩和安装应用程序。Inno Setup根据用户输入从位置下载文件

现在我有这样的:

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; 

感谢的建议和帮助

回答

0

调用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; 
+0

感谢马丁的回答,我粘贴你的代码上面。但点击下一步后,没有任何反应,因为我改变了http地址。可能有一些Identifer错误?感谢您的建议 –

+0

您已删除'idpDownloadAfter(wpReady);'。它必须保持在原来的位置。 –

+0

谢谢:)我希望所以最后的问题:)如何idpAddFille发送输入?在上面的代码中,我粘贴问题。 –