Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Built-in Messages in Inno Setup

How can I use a built-in message in Inno Setup?

In "Default.isl" there is a message "FullInstallation" that I would like to use in my Inno Setup script. This message is therefore already translated in all languages that Inno Setup supports. It would save me from needing to do translations myself for this text.

I see that "Default.isl" has a [CustomMessages] section, and I can use these using (for example) {cm:CreateDesktopIcon} (since "CreateDesktopIcon" exists as a Custom Message).

How do I use one of the other messages not listed in the [CustomMessages] section?

like image 433
chowey Avatar asked Dec 19 '13 18:12

chowey


1 Answers

As far as I know, there is no {cm:...} like constant by which you could expand a [Messages] entry. If I'm right, then it depends on where do you want to use such constant. If it's in the scripting part, then you'll need to use a scripted constant with a getter calling the SetupMessage function, by which you can expand those built-in messages for selected language by the constants listed in this file.

As you can notice, every message constant has just the msg prefix of the [Messages] entry from the language file.

For instance, to expand the WizardPreparing message into the Description value for the [Run] section entry you would expand the msgWizardPreparing constant this way:

[Run]
Filename: "MyProg.exe"; Description: "{code:GetDescription}"

[Code]
function GetDescription(Value: string): string;
begin
  Result := SetupMessage(msgWizardPreparing);
end;

In the [Code] section is the situation naturally easier, since the SetupMessage function you can use directly there. So, for instance, to show a message box with the expanded CannotContinue message you'd expand the msgCannotContinue constant simply this way:

[Code]
procedure InitializeWizard;
var
  S: string;
begin
  S := SetupMessage(msgCannotContinue);
  MsgBox(S, mbInformation, MB_OK);
end;
like image 86
TLama Avatar answered Nov 11 '22 03:11

TLama