7

I want my installation should be silent without any Next or Install buttons clicked by the user. I tried to disable all pages still, I am getting the "Ready to Install" page. I want avoid this install page.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Priyu
  • 93
  • 1
  • 8

1 Answers1

7

To run an installer built in Inno Setup without any interaction with the user or even without any window, use the /SILENT or /VERYSILENT command-line parameters:

Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When a setup is very silent this installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with DisableStartupPrompt or the '/SP-' command line option explained above).


You may also consider using the /SUPPRESSMSGBOXES parameter.


If you want to make your installer run "silently" without any additional command-line switches (what is imo very wrong approach), you can:

[Code]

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := True;
end;

function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord;
  external 'SetTimer@User32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;
  external 'KillTimer@User32.dll stdcall';

var
  SubmitPageTimer: LongWord;

procedure KillSubmitPageTimer;
begin
  KillTimer(0, SubmitPageTimer);
  SubmitPageTimer := 0;
end;  

procedure SubmitPageProc(
  H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
begin
  WizardForm.NextButton.OnClick(WizardForm.NextButton);
  KillSubmitPageTimer;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpReady then
  begin
    SubmitPageTimer := SetTimer(0, 0, 100, CreateCallback(@SubmitPageProc));
  end
    else
  begin
    if SubmitPageTimer <> 0 then
    begin
      KillSubmitPageTimer;
    end;
  end;
end;

For CreateCallback function, you need Inno Setup 6. If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library.

Another approach is to send CN_COMMAND to the Next button, as shown here: How to skip all the wizard pages and go directly to the installation process?


Another option (with its own caveats) is respawning the installer with the /[VERY]SILENT switch. You can use the technique described here:
Inno Setup specify log name within the installer


For a similar question with different answers, see How to make the silent installation by using Inno Setup?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992