我目前正在使用[Files] Flags: external将用户数据导入到我的安装中,正在运行。

现在,我需要在安装过程中提示您输入特定的外部文件。

用例:
我们安装需要许可证文件的软件(请勿与许可证协议(protocol)混淆)。我想提示用户输入他们的许可证文件。他们提供文件后,会将其复制到DestDir

我正在寻找类似[Files] Flags: PromptForFile或实现相同目的的例程。有人已经解决了吗?

最佳答案

使用 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;

inno-setup - Inno Setup提示您输入外部文件-LMLPHP

TODO:您需要以某种方式处理用户没有选择任何许可证文件的情况。不允许继续(使用 NextButtonClick )或跳过文件安装(使用 Check parameter)。

10-07 13:43
查看更多