Add user defined command line parameters to /? window - inno-setup

With Inno Setup it is possible to add user defined command line parameters. When I use the /?, /HELP command the user defined parameters are not listed there. How can I add my commands with a description to the /?, /HELP window?

Inno Setup 6.0 supports HelpTextNote message, whose contents will be inserted into the /HELP box.
In older versions:
You cannot.
The help text is hard-coded and not customizable in any way. It's not even localized.
It is even displayed before any Pascal Script code (InitializeSetup) is executed, so there's even no room to install some fancy hook to modify the message box on runtime.
See the ShowHelp function in the SetupLdr.dpr.
All you can do is to implement a custom switch (e.g. /usage) and handle it in the InitializeSetup event function.
Or, of course, you can modify Inno Setup source code and re-compile it. It's open source.
A related question: Is it possible to accept custom command line parameters with Inno Setup

Related

How do we access command line switches passed to an Inno Setup uninstaller?

Can Inno Setup handle this?
How do we access command line parameters/switches passed to an Inno Setup uninstaller?
I'm trying to make a conditional uninstaller in Innosetup that can conditionally leave behind files. I'd like it to be silent, hence the command line switches.
You can use ParamStr and ParamCount functions.
In case your command-line switch have a value, using {param:ParamName} pseudo-constant can be more convenient.
For some examples, see some of more specific questions on Inno Setup custom command-line arguments:
Is it possible to accept custom command line parameters with Inno Setup
Passing conditional parameter in Inno Setup
How can I resolve installer command-line switch value in Inno Setup Pascal Script?

How can I resolve installer command-line switch value in Inno Setup Pascal Script?

I am trying to fire a S2S pixel from the installer when an install is successful. The pixel require some details like the IP, location, time and sub-id.
I got all the details except the sub id, which is specified on the command line using /subID=xxxx switch, when executing the installer.
You can use the {param:ParamName} pseudo-constant.
See also Is it possible to accept custom command line parameters with Inno Setup.
In a Pascal Script you can resolve it using the ExpandConstant function:
ExpandConstant('{param:subID}')
If you need some custom parsing, you will have to parse the command-line explicitly by iterating the parameter list using the ParamStr and ParamCount function.
See some of the answers in the question linked above, and also:
Passing a string value to Inno Setup from command line app
Install files if command-line switch is passed to Inno Setup based installer

Default Values to Inno Setup install

I have a group at work asking if there is a way to pass in values, either via command line or an ini value, that will "fill in" values that are normally provided by the user during install. For example, if I have a drop down that the user can select they're installing the client, server, or both, they want a way to automate this so the user doesn't have to select anything.
Basically, they want to automate running the installer without actually showing the wizard panels and populating user values based on command line args or an ini file.
I know you can use ini files, but I don't think they're used for this reason. And I don't see any way that command args would be used.
Is there a way native to Inno Setup to do this?
Thanks!
One way to set all the standard settings at once is to use an INF file via the /LOADINF parameter.
It is also possible to extend this to custom page settings if you wish (with cooperation by the setup author).
There are many command line parameters already included in Inno which you can use: http://www.jrsoftware.org/ishelp/index.php?topic=setupcmdline
With them you can set task, directory, group, components, password etc etc.
If you need something special you can use your own command line parameters.
Use GetCmdTail() function to get cmd line parameters for setup or uninstaller.
As this is common question there are already some advanced parsers and methods like this one:
Is it possible to accept custom command line parameters with Inno Setup
I suggest you to use /SILENT parameter for not showing the setup forms together with e.g. /TASKS, /DIR and /COMPONENTS and some custom parameter.

Is it possible to control which files to install from command line for INNO installer?

I would like to control a subset of files and only allow some of them to be installed if run with a command line switch for instance.
Is this possible?
For example
if (some condition)
install full set of files
else
Install other set of files
Alternatively I can just run another installer but then I have to pass the file/path location to that second installer. There is also the issue of bundling that second installer with the first one. I think that part is not that difficult though
Yes, it is even rather easy. There are several ways to do this, all of which depend on Pascal scripting.
Method 1
You can use the GetCmdTail, ParamCount, and ParamStr functions to obtain the entire or parts of the command-line.
Then you can use the Check parameter on separate files. Hence, each file will be installed if and only if the called function returns true.

how to display please wait dialog during EXEC() function

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.

Resources