2016-12-05 189 views
3

我目前使用[Files] Flags: external將用戶數據導入到正在工作的安裝中。Inno Setup外部文件位置提示

我現在需要在安裝過程中提示輸入特定的外部文件。

使用案例:
我們安裝需要許可證文件的軟件(不要與許可證協議混淆)。我想提示用戶輸入他們的許可證文件。一旦他們提供了一個文件,它將被複制到DestDir

我正在尋找像[Files] Flags: PromptForFile或實現相同的例程。有人已經解決了這個問題?

回答

2

使用CreateInputFilePage function創建自定義嚮導頁面來提示用戶輸入許可證文件。

然後,使用scripted constant將所選路徑用作[Files]部分中的源路徑。

[Files] 
Source: "{code:GetLicensePath}"; DestDir: "{app}"; Flags: external 

[Code] 

var 
    LicenseFilePage: TInputFileWizardPage; 

procedure InitializeWizard(); 
begin 
    LicenseFilePage := 
    CreateInputFilePage(
     wpSelectDir, 
     'Select License File Location', 
     'Where is your license file located?', 
     'Select where License file is located, then click Next.'); 

    LicenseFilePage.Add(
    'Location of license file:',   
    'License files|*.lic|All files|*.*', 
    '.lic');        
end; 

function GetLicensePath(Param: string): string; 
begin 
    Result := LicenseFilePage.Values[0]; 
end; 

License file page


TODO:你需要以某種方式處理的情況下,當用戶不選擇任何許可文件。請不要繼續(使用NextButtonClick)或跳過文件安裝(使用Check parameter)。