Using a standard Inno Setup message in the Run ent

2019-05-30 06:51发布

问题:

There is a related question for those who are interested here. I was encouraged to ask one of the questions separately.

So I have this [Run] code:

Filename: "{cmd}"; Parameters: "/C exit"; Description: "Exit Setup";  \
    Flags: nowait postinstall runasoriginaluser unchecked skipifsilent; Check: IsWin64

It works well. It shows the following window at the end of the installation:

But the problem is that the wording Exit Setup is hard coded in English. Now, I have looked at the default.isl file and located:

ExitSetupTitle=Exit Setup
ClickFinish=Click Finish to exit Setup.

I don't know if I should be using either of these messages. It makes sense to me to use the ClickFinish because that is what the user will be doing.

But I can't work out how to use that message in the run statement.

Update

I have modified the supplied answer to:

function GetClickFinishSetupMessage(Param: string): string;
var
  I: integer;
  S1: string;
  S2: string;
begin

  S1 := SetupMessage(msgClickFinish);
  I := Length(S1);
  S2 := Copy(S1, I-1, 1);
  if(S2 = '.') then
      S1 := Delete(S1, I-1, 1);
  end;

  result := S1;
end;

So I could remove the final period. But it will not compiled. It says there is a mismatch for the third parameter of Delete.

回答1:

Use SetupMessage support function from a scripted constant:

[Run]
Filename: ...; Description: {code:GetClickFinishSetupMessage}
[Code]

function GetClickFinishSetupMessage(Param: string): string;
begin
  Result := SetupMessage(msgClickFinish);

  { Drop trailing dot, if any }
  if Copy(Result, Length(Result), 1) = '.' then
    SetLength(Result, Length(Result) - 1);
end;


标签: inno-setup