2017-08-04 40 views
0

我嘗試解壓縮從我的存儲庫下載的安裝文件。我發現這個代碼:
How to get Inno Setup to unzip a file it installed (all as part of the one installation process)Inno安裝程序從輸入用戶解壓文件

但我需要輸入從用戶自定義頁面有關應用程序的版本庫,下載並解壓試試。如何發送從輸入值到ExtractMe('{tmp}\INPUT FROM USER VERSION.zip', '{app}\');

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'); 
end; 

{Called when the user clicks the Next button} 
function NextButtonClick(CurPageID: Integer): Boolean; 
var 
    Version: string; 
    FileURL: string; 
begin 
    if CurPageID = wpReady then 
    begin 
    Version := UserPage.Values[0]; 
    {Download} 

    FileURL := Format('http://127.0.0.1/repository/ia/ats-apps/ia-client.zip/%s/ia-client.zip-%0:s.zip', [Version]); <-- FROM HERE TO BELOW 
    idpAddFile(FileURL, ExpandConstant(Format('{tmp}\%s.zip', [Version]))); 
    idpDownloadAfter(wpReady); 
    end; 
    Result := True; 
end; 

procedure unzip(src, target: AnsiString); 
external '[email protected]:unzipper.dll stdcall delayload'; 

procedure ExtractMe(src, target : AnsiString); 
begin 
    unzip(ExpandConstant(src), ExpandConstant(target)); 
end; 

procedure CurStepChanged(CurStep: TSetupStep); 
begin 
    if CurStep = ssPostInstall then 
    begin 
    ExtractMe('{tmp}\INPUT FROM USER VERSION.zip', '{app}\'); <--HERE 
    end; 
end; 

感謝您的提示。

回答

0

與您在NextButtonClick中已經使用的方法相同:請閱讀UserPage.Values[0]

ExtractMe(Format('{tmp}\%s.zip', [UserPage.Values[0]]), '{app}\'); 
+0

你是我的英雄:)謝謝! –

相關問題