1

I am trying to use the idea from Inno Setup - How to hide certain filenames while installing? (FilenameLabel)

The only sure solution is to avoid installing the files, you do not want to show, using the [Files] section. Install them using a code instead. Use the ExtractTemporaryFile and FileCopy functions

But the files that I want to hide are using in the [Run] Section:

[Files]
Source: "_Redist\DXWebSetup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

[Run]
Filename: "{tmp}\DXWebSetup.exe"; Components: DirectX; StatusMsg: "Installing DirectX..."; \
  BeforeInstall: StartWaitingForDirectXWindow; AfterInstall: StopWaitingForDirectXWindow

How to hide (while installing, in filenamelabel) using [Files] section, ExtractTemporaryFile and FileCopy functions?

Community
  • 1
  • 1
Nico Z
  • 997
  • 10
  • 33

1 Answers1

1

The easiest is to give up on the standard [Files] and [Run] sections and code everything on your own in the CurStepChanged event fuction:

[Files]
Source: "dxwebsetup.exe"; Flags: dontcopy

[Code]

procedure CurStepChanged(CurStep: TSetupStep);
var
  ProgressPage: TOutputProgressWizardPage;
  ResultCode: Integer;
begin
  if CurStep = ssInstall then { or maybe ssPostInstall }
  begin
    if IsComponentSelected('DirectX') then
    begin
      ProgressPage := CreateOutputProgressPage('Installing prerequsities', '');
      ProgressPage.SetText('Installing DirectX...', '');
      ProgressPage.Show;
      try
        ExtractTemporaryFile('dxwebsetup.exe');
        StartWaitingForDirectXWindow;
        Exec(ExpandConstant('{tmp}\dxwebsetup.exe'), '', '', SW_SHOW,
             ewWaitUntilTerminated, ResultCode);
      finally
        StopWaitingForDirectXWindow;
        ProgressPage.Hide;
      end;
    end;
  end;
end;

This even gives you a chance to check for results of the sub-installer. And you can e.g. prevent the installation from continuing, when the sub-installer fails or is cancelled.

Then it's easier to use the PrepareToInstall instead of the CurStepChanged.


Another option is to display a custom label, while extracting the sub-installer.
See Inno Setup - How to create a personalized FilenameLabel with the names I want?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Start be removing all the `ProgressPage` code. Instead, set the `StatusLabel.Caption := 'Installing DirectX...';` – Martin Prikryl Mar 07 '17 at 06:56
  • See also [Inno Setup: How to manipulate progress bar on Run section?](http://stackoverflow.com/q/34336466/850848) and [Inno Setup: Execute a Pascal function in \[Run\] section](Inno Setup: Execute a Pascal function in [Run] section). – Martin Prikryl Mar 07 '17 at 07:13
  • See [Inno Setup Placing image/control on custom page](https://stackoverflow.com/q/43696537/850848). – Martin Prikryl Jun 12 '17 at 15:00