Robert Wigley
Robert Wigley

Reputation: 1957

Inno Setup conditionally skip the Finished page

I am trying to conditionally skip the Finished page through use of a Task to allow the user the choice of whether they want to have Setup 'Auto-Finish'. I have tried the following:

[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;

But, when compiling, I get:

Value of [Setup] section directive "DisableFinishedPage" is invalid.

I therefore assume that this directive does not accept a conditional value through code, even though other [Setup] directives do? Is there another way to achieve this, or am I doing something wrong?

Upvotes: 1

Views: 1295

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202272

The DisableFinishedPage directive does not support scripted constants.

Use the ShouldSkipPage event function instead:

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

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

See also Skipping custom pages based on optional components in Inno Setup.

Upvotes: 1

Related Questions