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?
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With