Inno Setup有条件地跳过完成页面

时间:2016-10-17 10:29:15

标签: inno-setup

我试图通过使用Task有条件地跳过完成页面,以允许用户选择是否要安装“自动完成”。我尝试过以下方法:

[Setup]
DisableFinishedPage={code:GetAutoFinishStatus}

[Tasks]
Name: "AutoFinish"; Description: "Auto-Finish Installation"; \
    GroupDescription: "Post Installation Options"; Flags: unchecked; Components: MyApp

[Code]
function GetAutoFinishStatus(Param: String): String;
begin
  if IsTaskSelected('AutoFinish') then
    Result := 'yes';
end;

但是,在编译时,我得到:

  

[Setup]部分指令“DisableFinishedPage”的值无效。

因此,我假设该指令不接受通过代码的条件值,即使其他[Setup]指令有效?还有另一种方法可以达到这个目的,还是我做错了什么?

1 个答案:

答案 0 :(得分:1)

DisableFinishedPage directive不支持脚本常量。

改为使用ShouldSkipPage event function

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := False;

  if PageID = wpFinished then
  begin
    Result := IsTaskSelected('AutoFinish');
  end;
end;

另见Skipping custom pages based on optional components in Inno Setup