Capture events of other installer file like Notepad++ setup in Inno Setup

586 views Asked by At

I want to execute an executable file (npp.exe) before installation begins in Inno Setup. But I am not able to capture the nextButton event of the npp.exe executable. Is there any way to do it? I tried with following code:

function initializeSetup(): boolean;
var
  ResultCode: integer;
  path: string;
begin
   if Exec(('C:\Users\Paxcel\Downloads\npp.exe'), '', '', SW_SHOW,
       ewWaitUntilTerminated, ResultCode) then
    begin
       //result code = 0 for successful installation
       if (ResultCode = 0)then
          begin
              Result := True;
          end
          else
          begin
              Result := False;
          end;
    // handle success if necessary; ResultCode contains the exit code
     end
     else begin
        MsgBox(SysErrorMessage(ResultCode),mbError,MB_OK);
        Result := False;// handle failure if necessary; ResultCode contains the error code
     end;
   end;

In this code, I want to capture the next button of Notepad++ setup. Default functions like NextButtonClick cannot be used.

1

There are 1 answers

2
Martin Prikryl On

The Notepad++ uses NSIS installer.

If you want to run (any) NSIS installer silently, use /S command-line switch.

See NSIS Installer usage.


Btw, I assume that the path C:\Users\Paxcel\Downloads is just for testing. In a real installer, you have to embed the dependency to your installer and extract it to a temporary directory to execute it.

Inno Setup can do this all for you, you typically do not need to code this yourself using Pascal Scripting.

[Run]
Source: "path\npp.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

[Run]
Filename: "{tmp}\npp.exe"; Parameters: "/S"