Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup: Install other installer and run it before continuing my install

This is the [Files] portion of my code so far:

[Files] Source: "other_installer.exe"; DestDir: "{app}" Source: "myprogram.exe"; DestDir: "{app}" Source: "data.dat"; DestDir: "{app}" Source: "otherdata.dat"; DestDir: "{app}" 

My program is dependent on another program to run. I've included the installer for this program ("other_installer.exe") in my installer. What I would like to do is launch this installer as soon as it has been copied, before continuing with "myprogram.exe" and the rest.

I've googled and found the documentation for BeforeInstall in the Inno Setup Help, but they don't have an example of running another application. I believe it should be something like this:

[Files] Source: "other_installer.exe"; DestDir: "{app}" Source: "myprogram.exe"; DestDir: "{app}"; BeforeInstall: // RUN OTHER_INSTALLER.EXE // Source: "data.dat"; DestDir: "{app}" Source: "otherdata.dat"; DestDir: "{app}" 
like image 972
Juicy Avatar asked Oct 25 '13 12:10

Juicy


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.

Is Inno Setup free?

Inno Setup is a free installer for Windows programs by Jordan Russell and Martijn Laan. First introduced in 1997, Inno Setup today rivals and even surpasses many commercial installers in feature set and stability.

Is Inno Setup open source?

Inno Setup grew popular due to being free and open source; free for both commercial and non-commercial use, many software companies switched to the tool.


1 Answers

Better for the way you go might be the AfterInstall parameter. The following script will execute the RunOtherInstaller function right after the OtherInstaller.exe file entry is processed. There it tries to execute the just installed OtherInstaller.exe file and if that fails, it reports an error message to the user. Please note that you cannot interrupt the installation from that function, so it's not much safe to do what you want this way:

[Setup] AppName=My Program AppVersion=1.5 DefaultDirName={pf}\My Program  [Files] Source: "OtherInstaller.exe"; DestDir: "{app}"; AfterInstall: RunOtherInstaller Source: "OtherFile.dll"; DestDir: "{app}"  [Code] procedure RunOtherInstaller; var   ResultCode: Integer; begin   if not Exec(ExpandConstant('{app}\OtherInstaller.exe'), '', '', SW_SHOWNORMAL,     ewWaitUntilTerminated, ResultCode)   then     MsgBox('Other installer failed to run!' + #13#10 +       SysErrorMessage(ResultCode), mbError, MB_OK); end; 
like image 97
TLama Avatar answered Sep 21 '22 05:09

TLama