2017-08-03 106 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發送輸入?在上面的代碼中,我粘貼問題。 –