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}"
Another good time to run prerequisite installers is in the
PrepareToInstall
event function. (See the example scripts provided with Inno for the basic structure, and TLama's code for the actual execution.)The main advantage of
PrepareToInstall
is that it allows you to handle errors and reboot requests from the child installer -- usingAfterInstall
doesn't.The main disadvantage of it is that you have to manually
ExtractTemporaryFile
anything required to run the child install, as this occurs prior to files being extracted.You can use AfterInstall, look for this in the Help. When file is just copied, i'll launch the function/procedure you put as "AfterInstall:".
In this function/procedure, use Exec and launch the other installer.
Better for the way you go might be the
AfterInstall
parameter. The following script will execute theRunOtherInstaller
function right after theOtherInstaller.exe
file entry is processed. There it tries to execute the just installedOtherInstaller.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: