I have designed my installer using Inno Setup to display 2 components for the user to select. According to his/her selection, the Finish page at the end will show Launch program checkbox(es). The default value for the checkbox is false if both components have been selected.
So far, so good.
Now, I want that if only one of the components is selected for installation by the user, the default value of the checkbox should be true.
Following are the Component and Run sections of the installer,
[Components]
Name: "Component1"; Description: "Component1"; Types: full;
Name: "Component2"; Description: "Component2"; Types: full custom;
[Run]
Filename: "{localappdata}\MyInstaller\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent unchecked; Components:Component1;
Filename: "{localappdata}\MyInstaller\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(TestAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent unchecked; Components:Component2
I understand that what I want, requires some scripting to be done. I am at a loss at what to do.
Please guide.
The Components
parameter allows you to use boolean expression operators so for your case you may write two pairs of entries where one is for unchecked check box and the second for checked. The rest of what you need is writing an expression:
[Components]
Name: "Component1"; Description: "Component1";
Name: "Component2"; Description: "Component2";
[Run]
; this is the entry pair for unchecked check box; it is shown if both components
; are selected
Filename: "{app}\MyProg1.exe"; Flags: nowait postinstall skipifsilent unchecked; Components: Component1 and Component2;
Filename: "{app}\MyProg2.exe"; Flags: nowait postinstall skipifsilent unchecked; Components: Component1 and Component2;
; this is the entry pair for checked check box; it is shown only when the given
; component is selected and the other not
Filename: "{app}\MyProg1.exe"; Flags: nowait postinstall skipifsilent; Components: Component1 and not Component2;
Filename: "{app}\MyProg2.exe"; Flags: nowait postinstall skipifsilent; Components: Component2 and not Component1;
That will produce: