Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a file before setup with Inno Setup

Tags:

Is it possible to run a file with Inno Setup, before the setup beginns? Documentation

like image 769
Stephan Schielke Avatar asked Aug 16 '10 13:08

Stephan Schielke


People also ask

How do I make an inno file executable?

Go to Menu, Project, then Compile to compile and create the setup file. This will create a complete installer. Run the Setup and your application will be installed correctly. Innosetup offers an awesome alternative to create great looking Installers for free.

What is an Inno Setup file?

Inno Setup is a free software script-driven installation system created in Delphi by Jordan Russell. The first version was released in 1997. Inno Setup. Screenshot of the Inno Setup IDE running on Windows 7. Developer(s)

How do you write an Inno Script?

The Inno Setup Example Scripts are located in a separate folder. Please click the "Inno Setup Example Scripts" shortcut created in the Start Menu when you installed Inno Setup, or open the "Examples" folder in your Inno Setup directory.

What language does Inno Setup use?

Inno Setup's [Code] section uses Pascal (or Pascal Script to be more exact, thanks to TLama), likely because Inno Setup itself is written in Pascal Delphi.


1 Answers

Yes it is. In the [code] section run the file in the InitializeSetup() function. This example launches notepad before the setup runs.

function InitializeSetup(): boolean;
var
  ResultCode: integer;
begin

  // Launch Notepad and wait for it to terminate
  if Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode) then
  begin
    // handle success if necessary; ResultCode contains the exit code
  end
  else begin
    // handle failure if necessary; ResultCode contains the error code
  end;

  // Proceed Setup
  Result := True;

end;
like image 74
Jan Derk Avatar answered Oct 26 '22 16:10

Jan Derk