Inno Setup - How to create a personalized FilenameLabel with the names I want?

inno-setup

Solution

As explained in the answer you've linked:

- create a new custom "filename" label;

- hide the original `FilenameLabel`;

- implement the `CurInstallProgressChanged` to map the filename to anything you want to display and show it on the custom label.

[Files]
Source: "data1.dat"; DestDir: {app}
Source: "data2.dat"; DestDir: {app}
Source: "data3.dat"; DestDir: {app}
[Code]

var
  MyFilenameLabel: TNewStaticText;

procedure InitializeWizard();
begin
  MyFilenameLabel := TNewStaticText.Create(WizardForm);
  { Clone the FilenameLabel }
  MyFilenameLabel.Parent := WizardForm.FilenameLabel.Parent;
  MyFilenameLabel.Left := WizardForm.FilenameLabel.Left;
  MyFilenameLabel.Top := WizardForm.FilenameLabel.Top;
  MyFilenameLabel.Width := WizardForm.FilenameLabel.Width;
  MyFilenameLabel.Height := WizardForm.FilenameLabel.Height;
  MyFilenameLabel.AutoSize := WizardForm.FilenameLabel.AutoSize;

  { Hide real FilenameLabel }
  WizardForm.FilenameLabel.Visible := False;
end;

procedure MapFilename(var Filename: string; Physical, Personalized: string);
begin
  if CompareText(Filename, Physical) = 0 then Filename := Personalized;
end;

procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
  Filename: string;
begin
  Filename := ExtractFileName(WizardForm.FilenameLabel.Caption);

  // Map filenames to descriptions
  MapFilename(Filename, 'data1.dat', 'Some hilarious videos');
  MapFilename(Filename, 'data2.dat', 'Some awesome pictures');
  MapFilename(Filename, 'data3.dat', 'Some cool music');

  MyFilenameLabel.Caption := Filename;
end;

Problem

How to create a personalized `FilenameLabel` with the names I want? How to implement the suggestion from Inno Setup - How to hide certain filenames while installing? (FilenameLabel) (third option, CurInstallProgressChanged, copy the files name, you want to show from the hidden to the custom label¨). I see this code: ``` procedure InitializeWizard; begin with TNewStaticText.Create(WizardForm) do begin Parent := WizardForm.FilenameLabel.Parent; Left := WizardForm.FilenameLabel.Left; Top := WizardForm.FilenameLabel.Top; Width := WizardForm.FilenameLabel.Width; Height := WizardForm.FilenameLabel.Height; Caption := ExpandConstant('{cm:InstallingLabel}'); end; WizardForm.FilenameLabel.Visible := False; end; ``` But, how to define, if is possible, the names of files that i want with `CurInstallProgressChanged`?

Original source