inno-setuppascalscript

Run installation using Inno Setup silently without any Next button or Install button


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.


Solution

  • 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.


    Alternate approaches: