Peter Štibraný
Peter Štibraný

Reputation: 32893

Add text to 'Ready Page' in Inno Setup

I added few custom pages to my Installer. These pages gather some data from user and disk, and I'd like to show this data to user before final installation step starts. Inno Setup has 'Ready to Install' page exactly for this purpose.

How can I add text to this page? By default it shows to me:

Destination location:
  C:\Program Files\MyProgram

I'd like to append some text here. Is it possible?

Upvotes: 17

Views: 14224

Answers (5)

Peter Štibraný
Peter Štibraný

Reputation: 32893

Found it ... https://jrsoftware.org/ishelp/index.php?topic=scriptevents:

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;

If Setup finds the UpdateReadyMemo event function in the Pascal script, it is called automatically when the Ready to Install wizard page becomes the active page. It should return the text to be displayed in the settings memo on the Ready to Install wizard page as a single string with lines separated by the NewLine parameter. Parameter Space contains a string with spaces. Setup uses this string to indent settings. The other parameters contain the (possibly empty) strings that Setup would have used as the setting sections. The MemoDirInfo parameter for example contains the string for the Selected Directory section.

Upvotes: 24

Martin Prikryl
Martin Prikryl

Reputation: 202272

As the existing answers show already, implement UpdateReadyMemo event function.

Implementing the function requires reimplementing an assembly of the default memo contents. Below is a less repetitive way to implement that.

procedure AddToReadyMemo(var Memo: string; Info, NewLine: string);
begin
  if Info <> '' then Memo := Memo + Info + Newline + NewLine;
end;

function UpdateReadyMemo(
  Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo,
  MemoGroupInfo, MemoTasksInfo: String): String;
begin
  AddToReadyMemo(Result, MemoUserInfoInfo, NewLine);
  AddToReadyMemo(Result, MemoDirInfo, NewLine);
  AddToReadyMemo(Result, MemoTypeInfo, NewLine);
  AddToReadyMemo(Result, MemoComponentsInfo, NewLine);
  AddToReadyMemo(Result, MemoGroupInfo, NewLine);
  AddToReadyMemo(Result, MemoTasksInfo, NewLine);

  Result := Result + 'Additional custom information';
end;

enter image description here

Upvotes: 3

Marcel
Marcel

Reputation: 1594

You can hook into the setup process of the ReadyMemo WizardPage using this function:

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;

If Setup finds the UpdateReadyMemo event function in the Pascal script, it is called automatically when the Ready to Install wizard page becomes the active page. It should return the text to be displayed in the settings memo on the Ready to Install wizard page as a single string with lines separated by the NewLine parameter. Parameter Space contains a string with spaces. Setup uses this string to indent settings. The other parameters contain the (possibly empty) strings that Setup would have used as the setting sections. The MemoDirInfo parameter for example contains the string for the Selected Directory section.

Official docs at: http://www.innosetup.org/ishelp/topic_scriptevents.htm

Here is a simple example implementation that adds a single line to the default content of the ReadyMemo:

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
    Result := ''

    if MemoUserInfoInfo <> '' then begin
        Result := MemoUserInfoInfo + Newline + NewLine;
    end;
    if MemoDirInfo <> '' then begin
        Result := Result + MemoDirInfo + Newline + NewLine;
    end;
    if MemoTypeInfo <> '' then begin
        Result := Result + MemoTypeInfo + Newline + NewLine;
    end;
    if MemoComponentsInfo <> '' then begin
        Result := Result + MemoComponentsInfo + Newline + NewLine;
    end;
    if MemoGroupInfo <> '' then begin
        Result := Result + MemoGroupInfo + Newline + NewLine;
    end;
    if MemoTasksInfo <> '' then begin
        Result := Result + MemoTasksInfo + Newline + NewLine;
    end;

    Result := Result + 'My custom string';
end;

For your information: I tried adding this code to the accepted answer, but it got declined and I was told to write a comment or a new answer.

Upvotes: 7

Armand
Armand

Reputation: 131

Alter the following code:

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpReady then
  begin
    Wizardform.ReadyMemo.Lines.Add(''); { Empty string }
    Wizardform.ReadyMemo.Lines.Add('Setup HP-UX test created by Armand');
  end;
end;

Upvotes: 13

whoisthemachine
whoisthemachine

Reputation: 510

Also, if you just want to change the pre-existing messages to something less generic, you can change them in your [Messages] section:

i.e.

[Messages]
ReadyMemoDir=Server location:

The default messages are:

  • WizardReady
  • ReadyLabel1
  • ReadyLabel2a
  • ReadyLabel2b
  • ReadyMemoUserInfo
  • ReadyMemoDir
  • ReadyMemoType
  • ReadyMemoComponents
  • ReadyMemoGroup
  • ReadyMemoTasks

Upvotes: 5

Related Questions