Can InnoSetup execute a program before the uninstallation starts? My program creates some registry values. I have an executable that can remove those registry values and my question is, can InnoSetup run that executable before the uninstallation starts?
See the documentation on Setup Script Sections, particularly the UninstallRun one at the bottom of the tree:
[UninstallRun]
Filename: "{app}\INIT.EXE"; Parameters: "/x"
If you need to do something more complex, you can also do it in code using the Pascal scripting functionality in InnoSetup. See UninstallCodeExample1.iss' in theInnoSetup 5\Examples` folder.
Related
Is it possible to use as an output directory not only one location?
Something like this:
[Setup]
OutputDir=C:\MyProject; C:\Installers
No, you cannot.
If you are compiling the installer as a part of a larger build process, you can clone the output files as part of that.
See also:
Run a [Code] or PowerShell script in Inno Setup compiler
One possible hack would be to execute some script in the background using preprocessor (as shown in the answer to the question above). And have the script watch for changes to the output file and copy it over to the other destination.
I have search for almost 2 days including going through regular documentation for inno setup. But I have not found a way for Inno setup to sequentially execute other uninstallers (3rd party apps), as items in the [UninstallRun] section. Since the other uninstallers are "cloned" the "waituntilterminated" flag doesn't work on those uninstallers. Has anyone come up with a way to accomplish this?
Thanks,
David
If the other uninstallers are Inno Setup-made, then I do not think you need to do anything special.
Inno Setup-made uninstaller really clones itself and run its clone internally. But it waits for the clone to actually complete the uninstallation before it closes itself. The only thing, that the clone does after the main uninstaller processes closes, is that it deletes the uninstaller executable (and its data files). I do not think you really need to wait for this to done. But if you do, just wait for the uninstaller files to be gone, before you proceed with the other uninstaller.
Is it possible for one .iss file to produce different setup exes at the same time? maybe with multiple [Setup] sections?
It is not possible to create more than one output setup exe at the same time, but it is possible to create more than one from a single script.
The key is to use ISPP's #define and #ifdef or #if directives to designate parts of your script which are only compiled if specific variables are defined or given a particular value. You can then use a batch script to invoke iscc with the /dVAR or /dVAR="VALUE" parameters (which are the equivalent of a #define) to select different conditions for each compile.
This is only really useful if the scripts are largely the same, however (eg. if you want to make separate installers for different "editions" of an application, instead of including all files for the largest edition and deciding at runtime which to install). If your scripts are completely different from each other, then you should just create separate scripts and compile them from a batch file or an automated build script.
Test result:
By running a simple test... No, this is not possible. At first you can introduce sections on several places in a script. Consider you can do the following in your script:
[Setup]
AppName=My Program 1
AppVersion=1.5
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
[Setup]
DefaultDirName={pf}\My Program
From that you can see that compiler wouldn't recognize which one of the [Setup] sections belongs to which setup if you could write the script for more of them in one script file.
Workaround:
However, if you need to automate the build process on a basic level, you can create a batch file and run the compiler through the command line for all of your scripts. See the reference about command line compiler usage.
If you will compile several scripts with the same output directory, don't forget to specify different value of the OutputBaseFilename directive (the output exe name) for each script file.
Assume a Visual C++ solution that outputs several executables. These executables are meant to be run in a certain order and with certain parameters -- and for this purpose there already is an ant build.xml script.
What would be a decent approach to integrating this ant script with VC++, such that the ant script will point against the recently output executables (.\Debug and .\Release folders) and ideally could be run directly from VC++, and dare I say with remote debugging.
I was thinking of using build post-events that populate a build.properties file with the output location of each executable, and let the ant script use this .properties file.
Any help on the matter would be great.
I'm not sure if there is a good answer for this. Perhaps you are not asking the right questions. From C++ you can launch anything, including scripts. I'm not sure what you mean by VC++ integration.
The generic answer would be:
save the output locations somewhere, doesn't matter where (file, registry, environment variables etc.)
retrieve them in the script before use
But depending on what you need, you could also try:
Output the same executables in the same folder structure. This way you can use relative paths.
Use a post-build event which copies the script in the output folder and make it use the relative path.
Instead of a script you can also try handling everything from the first EXE. Instead of an ANT script it could use a configuration file which specifies execution order and parameters.
how to display please wait dialog while EXEC() runs another application silently.
You can use a ProgressOutputWizardPage, which works just fine for me, which isn't exactly complicated. You can refer to the CodeDlg.iss example.
Do you really need it to be a message box? As you might know, you can run an external *.exe during setup, and have a custom status message shown meanwhile. (The status message will be on the usual progress label during installation.)
I have a setup.exe that installs product A. This setup.exe contains a setup2.exe file, used to setup product B. setup.exe copies setup2.exe to the Program Files folder during the installation of product A. When all files have been copied, setup.exe then starts setup2.exe in the background. To accomplish this, i have done
[Run]
Filename: "{app}\setup2.exe"; StatusMSG: "Installing Product 2..."; Parameters: "/VERYSILENT /SUPPRESSMSGBOXES"
in setup.iss (that compiles to setup.exe). setup2.exe is also an Inno Setup installer, so the parameters "/VERYSILENT /SUPPRESSMSGBOXES" will make the installation of product 2 silent. During this setup, setup.exe will show the message "Installing Product 2...".
If you really need a message box to popup with the status message, you'll have to resort to Pascal scripting.