I need to make a setup with multiple versions of software and i want to make it have the option for portable / install.
I have a customized components page. It should show after info page and then the directory selection page should show once the options are selected. I THINK I have the [Files] and [Tasks] and [Components] sections figured out. It's mainly the code section I am struggling with.
For example if the user selects to install the Pro version by using the radio button, once Next is clicked it should show the directory selection page and then after continuing it should install or extract (depending on portable or install selections). The installer should install/extract the specified version based on specified files marked as Pro (in the [Files] and [Components] sections).
I have tried lots of variations of code but my current variation is below and it does not work (ignore the SelectedValueIndex numbers, I have yet to put the correct value in but I wanted to make sure it would compile first).
I have code for silent switches that i have to link to the radio buttons too but I think that part will work. Its literally just trying to get the selections (radio buttons and check boxes) to work. Also if you select install for one of the versions id like the group box for portable options to be greyed out (un-selectable) and vice versa. At the moment I can't get the radio buttons to have any values they just do nothing.
Simpler explanation:
Lets say there are two versions of an application Free and Pro.
The files that install depend on whether the user selects Free or Pro. (Set in the [Files], and [Components] Sections respectively).
procedure InitializeWizard();
var SystemMenu: HMENU;
begin
{Create Mode Selection Page}
UsagePage := CreateInputOptionPage(wpInfoBefore,
'Mode', 'Select Installation Mode',
'Mode',
True, False);
UsagePage.Add('FreeInstall');
UsagePage.Add('BusinessInstall');
UsagePage.Add('TechnicianInstall');
UsagePage.Add('ProfessionalInstall');
UsagePage.Add('FreePortable');
UsagePage.Add('BusinessPortable');
UsagePage.Add('TechnicianPortable');
UsagePage.Add('ProfessionalPortable');
//
{Set Default Checkbox - Normal Install}
if (FreeInstall)
then
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
if (BusinessInstall)
then
// Set the Respective Checkbox on The Wizard.
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
if (TechnicianInstall)
then
// Set the Respective Checkbox on The Wizard.
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
if (ProfessionalInstall)
then
// Set the Respective Checkbox on The Wizard.
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
{Set Default Checkbox - Portable}
if (FreePortable)
then
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
if (BusinessPortable)
then
// Set the Respective Checkbox on The Wizard.
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
if (TechnicianPortable)
then
// Set the Respective Checkbox on The Wizard.
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
if (ProfessionalPortable)
then
// Set the Respective Checkbox on The Wizard.
UsagePage.SelectedValueIndex := 1
else
UsagePage.SelectedValueIndex := 0;
WizardForm.Caption := '{#MyAppName} v{#MyAppVersion}';
TotalSpace;
WizardForm.DiskSpaceLabel.Hide;
It won't compile like this
Use Check parameter to bind [Files] section entries to the selection on the custom page:
[Files]
Source: "MyProgFree.exe"; DestDir: "{app}"; Check: IsModeSelected(0)
Source: "MyProgPro.exe"; DestDir: "{app}"; Check: IsModeSelected(1)
[Code]
var
UsagePage: TInputOptionWizardPage;
function IsModeSelected(Mode: Integer): Boolean;
begin
Result := (UsagePage.SelectedValueIndex = Mode);
end;
procedure InitializeWizard();
begin
UsagePage :=
CreateInputOptionPage(
wpInfoBefore, 'Mode', 'Select Installation Mode', 'Mode', True, False);
UsagePage.Add('FreeInstall');
UsagePage.Add('ProInstall');
end;
Related
My installer has a custom finish page with an image on it. I referred this Custom Welcome and Finished page with stretched image in Inno Setup solution for it. But the issue is with the check box at finish page, it is coming on top of the finish page image with a white background. If I removed postinstall flag, then it will automatically launch my app. But I want the user to be able to choose like how checkbox does. So is there any way to transparent the check box launch message on top of my image? Would TNewCheckBox help here?
[Run]
Filename: "app\My program.exe"; Description: "{cm:LaunchProgram}"; #
Flags: nowait postinstall skipifsilent
In standard Inno Setup, I do not think you can make WizardForm.RunList (TNewCheckListBox) transparent. But as the simple TNewCheckListBox is transparent, you can replace the WizardForm.RunList with TNewCheckListBox.
[Code]
procedure RunCheckBoxClick(Sender: TObject);
begin
WizardForm.RunList.Checked[0] := TNewCheckBox(Sender).Checked;
end;
procedure CurPageChanged(CurPageID: Integer);
var
RunCheckBox: TNewCheckBox;
begin
if CurPageID = wpFinished then
begin
if (not WizardForm.RunList.Visible) or
(WizardForm.RunList.Items.Count < 1) then
begin
Log('No items to run');
end
else
if WizardForm.RunList.Items.Count > 1 then
begin
Log('More than one item to run, keeping the standard non-transparent run list');
end
else
begin
Log('Replacing the one item in the run list with a simple transparent checkbox');
RunCheckBox := TNewCheckBox.Create(WizardForm);
RunCheckBox.Parent := WizardForm.RunList.Parent;
RunCheckBox.Left := WizardForm.RunList.Left + ScaleX(4);
RunCheckBox.Top := WizardForm.RunList.Top + ScaleY(4);
RunCheckBox.Width := WizardForm.RunList.Width;
RunCheckBox.Height := ScaleY(RunCheckBox.Height);
RunCheckBox.Checked := WizardForm.RunList.Checked[0];
RunCheckBox.Caption := WizardForm.RunList.ItemCaption[0];
RunCheckBox.OnClick := #RunCheckBoxClick;
WizardForm.RunList.Visible := False;
end
end;
end;
This question already has answers here:
Inno Setup generated installer does not show "Select Destination Location" page on some systems
(3 answers)
Closed 4 years ago.
On first install everything runs smooth, but if I run the installer again it just jumps to the second page asking where i want to put the additional files, and then in the ready page only the parameters for the additional files folders is shown. The ignore version flag is set, what else could it be?
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
Compression=lzma
SolidCompression=yes
OutputBaseFilename=aeolian_meditation_setup
WizardSmallImageFile=compiler:greenlogo.bmp
WizardImageFile=compiler:glogo.bmp
DirExistsWarning=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
;Main program that will be installed in {app} folder
Source: "D:\ocean_swift\Flowstone Projects\Aeolian Meditation Advanced\OS Aeolian Meditation Advanced A191.exe"; DestDir: "{app}"; Flags: ignoreversion
;Database file that will installed where user choosed
Source: "D:\ocean_swift\Flowstone Projects\Aeolian Meditation Advanced\onts\OpenSans-Regular.ttf"; DestDir: "{fonts}"; Flags: onlyifdoesntexist; FontInstall: "Open Sans"
Source: "C:\Program Files (x86)\VSTPlugins\OS Aeolian Meditation Advanced A191.dll"; DestDir: "{code:GetDataDir}"
[Code]
var
DataDirPage: TInputDirWizardPage;
procedure InitializeWizard;
begin
// Create the page
DataDirPage := CreateInputDirPage(wpSelectDir,
'Select 32bit VST Plugin Directory', 'Where should the 32bit VSTi plugin be installed??',
'Select the folder in which Setup should install the 32bit VSTi plugin, then click Next.',
False, '');
DataDirPage.Add('');
DataDirPage.Values[0] := 'C:\Program Files (x86)\VSTPlugins\';
end;
procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
// Store the selected folder for further reinstall/upgrade
SetPreviousData(PreviousDataKey, 'DataDir', DataDirPage.Values[0]);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
// Set default folder if empty
if DataDirPage.Values[0] = '' then
DataDirPage.Values[0] := ExpandConstant('{sd}\DataDir');
Result := True;
end;
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
S: String;
begin
// Fill the 'Ready Memo' with the normal settings and the custom settings
S := '';
S := S + MemoDirInfo + NewLine + NewLine;
S := S + '32bit VSTi' + NewLine;
S := S + Space + DataDirPage.Values[0] + NewLine;
Result := S;
end;
function GetDataDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := DataDirPage.Values[0];
end;
If you look here you will see that the default value for DisableProgramGroupPage is auto. As described there:
If this is set to auto, at startup Setup will look in the registry to
see if the same application is already installed, and if so, it will
not show the Select Start Menu Folder wizard page.
If you review the other Disable entries in the help file you will see them behave the same. It is logical to only show these pages during a new install. Change the default behaviour by setting these to no.
I have a problem in [Run] Section of my Inno Setup Script.
Whether I check or uncheck the CheckBox which appears in the CurPageID = wpFinished, my program never launches.
I set the default value of it to Checked.
Parts of my script whose belongs to this :
#define AppExec "hddbsfinder.exe"
#define AppName "HDD Bad Sectors Finder"
[Run]
Filename: "{app}\{#AppExec}"; Check: CheckLaunching; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: NoWait PostInstall
function CheckLaunching: Boolean;
begin
Result := not LauncherCB.Checked;
end;
var
LauncherCB: TNewCheckbox;
LauncherCB := TNewCheckBox.Create(WizardForm);
with LauncherCB do
begin
Parent := WizardForm;
Left := (225);
Top := (245);
Width := ScaleX(14);
Height := ScaleY(15);
end;
if CurPageID=wpSelectTasks then begin
LauncherCB.Hide;
LauncherCB.Checked := True;
end;
if CurPageID = wpFinished then begin
with WizardForm do begin
LauncherCB.Show;
end;
end;
My Program never launches even I check or uncheck that LauncherCB.
(The default value is Checked.)
Thanks in Advance.
The Check parameter of postinstall run entries is used to evaluate if to show the checkbox at all, not if to run the entry.
You have two options:
Implement the launching yourself in the NextButtonClick(wpFinished) using the Exec function.
Use the standard run checklist box, just it move to the location you need it at. You will probably need to change the list's .Parent to WizardForm to remove it from the "Finished" page.
With a single executable file generated with InnoSetup (with "IconMain.ico") and a single uninstall(with a different icon "IconUninst.ico"), I would like to install some files in drive "C" and "K". The user will not be allowed to change drive paths/names, as :
STANDART RADIOBUTTON -
Full installation. Files that will be installed in drive "C:" AND "K:"
- Game.exe --> DRIVE C:\games
- Mapping.exe --> DRIVE C:\Mapping
- Pics.dll --> DRIVE C:\Pics
- AAA.dll --> DRIVE K:\Sounds
- BBB.obj --> DRIVE K:\Sounds
'
ADVANCED RADIONBUTTON -
Partial installation.
The only files that will be installed. (IF user agrees to continue)
- AAA.dll --> DRIVE K:\Sounds
- BBB.obj --> DRIVE K:\Sounds
How can I accomplish that?
Thank you !
To conditionally install a certain file you need to use the Check parameter. You need to return True to the expression or function to install the item, False to skip. The example to your previous assignment is shown in the reference page I've linked in the previous sentence.
So to combine it with custom installation type radio buttons you've mentioned, you just need to make a function that will be assigned to the check and that will return its result depending on selected radio button.
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Files]
; these two items will be installed always
Source: "AAA.dll"; DestDir: "K:\Sounds"
Source: "BBB.obj"; DestDir: "K:\Sounds"
; these three items will be installed only when the IsFullInstallation
; function returns True, what will depend on the selected radio button
Source: "Game.exe"; DestDir: "C:\Games"; Check: IsFullInstallation;
Source: "Mapping.exe"; DestDir: "C:\Mapping"; Check: IsFullInstallation;
Source: "Pics.dll"; DestDir: "C:\Pics"; Check: IsFullInstallation;
[Code]
const
FullDescText =
'Full installation. Files will be installed on drives "C:" and "K:"';
PartDescText =
'Partial installation. Files will be installed on drives "C:" and "K:"';
var
FullRadioButton: TNewRadioButton;
PartRadioButton: TNewRadioButton;
procedure InitializeWizard;
var
CustomPage: TWizardPage;
FullDescLabel: TLabel;
PartDescLabel: TLabel;
begin
CustomPage := CreateCustomPage(wpWelcome, 'Installation type', '');
FullRadioButton := TNewRadioButton.Create(WizardForm);
FullRadioButton.Parent := CustomPage.Surface;
FullRadioButton.Checked := True;
FullRadioButton.Top := 16;
FullRadioButton.Width := CustomPage.SurfaceWidth;
FullRadioButton.Font.Style := [fsBold];
FullRadioButton.Font.Size := 9;
FullRadioButton.Caption := 'Full Installation'
FullDescLabel := TLabel.Create(WizardForm);
FullDescLabel.Parent := CustomPage.Surface;
FullDescLabel.Left := 8;
FullDescLabel.Top := FullRadioButton.Top + FullRadioButton.Height + 8;
FullDescLabel.Width := CustomPage.SurfaceWidth;
FullDescLabel.Height := 40;
FullDescLabel.AutoSize := False;
FullDescLabel.Wordwrap := True;
FullDescLabel.Caption := FullDescText;
PartRadioButton := TNewRadioButton.Create(WizardForm);
PartRadioButton.Parent := CustomPage.Surface;
PartRadioButton.Top := FullDescLabel.Top + FullDescLabel.Height + 16;
PartRadioButton.Width := CustomPage.SurfaceWidth;
PartRadioButton.Font.Style := [fsBold];
PartRadioButton.Font.Size := 9;
PartRadioButton.Caption := 'Partial Installation'
PartDescLabel := TLabel.Create(WizardForm);
PartDescLabel.Parent := CustomPage.Surface;
PartDescLabel.Left := 8;
PartDescLabel.Top := PartRadioButton.Top + PartRadioButton.Height + 8;
PartDescLabel.Width := CustomPage.SurfaceWidth;
PartDescLabel.Height := 40;
PartDescLabel.AutoSize := False;
PartDescLabel.Wordwrap := True;
PartDescLabel.Caption := PartDescText;
end;
function IsFullInstallation: Boolean;
begin
Result := FullRadioButton.Checked;
end;
The easiest way to make conditional installations is to use [Types] and [Components].
[Types]
Name: standard; Description: Standard
Name: partial; Description: Partial
[Components]
Name: game; Description: Full game install; Types: standard
Name: sounds; Description: Sound files; Types: standard partial
[Files]
...; Components: game
...; Components: sounds
I use the Inno Setup to create installer for my program. In my program I use third-party libraries, so I have to show license information for each of them.
also I want the installer to show certain license files to chosen language.
I know how to switch between license files if I have 1 license form.
I've looked in google for whole day but didn't find anything
how can I show several licenses?
You can make each license file match the language file by removing the LicenseFile directive from [Setup] and putting it in the [Languages] like this:
Name: "english"; MessagesFile: "compiler:Default.isl"; LicenseFile: "English License.rtf"
Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimp.isl"; LicenseFile: "Chinese SIM License.rtf"
Name: "chinesetrad"; MessagesFile: "compiler:Languages\ChineseTrad.isl"; LicenseFile: "Chinese TRA License.rtf"
etc...
Hope that helps
You can use the CreateOutputMsgMemoPage to create a page with the memo box on. You can then adjust the sizing and add the agree/disagree boxes.
; Shows a new license page for the LGPL with the usual accept/don't acccept options
[Code]
var
LGPLPage: TOutputMsgMemoWizardPage;
LGPLAccept: TNewRadioButton;
LGPLRefuse: TNewRadioButton;
procedure LGPLPageActivate(Sender: TWizardPage); forward;
procedure LGPLAcceptClick(Sender: TObject); forward;
procedure LGPL_InitializeWizard();
var
LGPLText: AnsiString;
begin
// Create the page
LGPLPage := CreateOutputMsgMemoPage(wpLicense, SetupMessage(msgWizardLicense), SetupMessage(msgLicenseLabel), CustomMessage('LGPLHeader'), '');
// Adjust the memo and add the confirm/refuse options
LGPLPage.RichEditViewer.Height := ScaleY(148);
LGPLAccept := TNewRadioButton.Create(LGPLPage);
LGPLAccept.Left := LGPLPage.RichEditViewer.Left;
LGPLAccept.Top := LGPLPage.Surface.ClientHeight - ScaleY(41);
LGPLAccept.Width := LGPLPage.RichEditViewer.Width;
LGPLAccept.Parent := LGPLPage.Surface;
LGPLAccept.Caption := SetupMessage(msgLicenseAccepted);
LGPLRefuse := TNewRadioButton.Create(LGPLPage);
LGPLRefuse.Left := LGPLPage.RichEditViewer.Left;
LGPLRefuse.Top := LGPLPage.Surface.ClientHeight - ScaleY(21);
LGPLRefuse.Width := LGPLPage.RichEditViewer.Width;
LGPLRefuse.Parent := LGPLPage.Surface;
LGPLRefuse.Caption := SetupMessage(msgLicenseNotAccepted);
// Set the states and event handlers
LGPLPage.OnActivate := #LGPLPageActivate;
LGPLAccept.OnClick := #LGPLAcceptClick;
LGPLRefuse.OnClick := #LGPLAcceptClick;
LGPLRefuse.Checked := true;
// Load the LGPL text into the new page
ExtractTemporaryFile('lgpl-3.0.txt');
LoadStringFromFile(ExpandConstant('{tmp}/lgpl-3.0.txt'), LGPLText);
LGPLPage.RichEditViewer.RTFText := LGPLText;
end;
procedure LGPLPageActivate(Sender: TWizardPage);
begin
WizardForm.NextButton.Enabled := LGPLAccept.Checked;
end;
procedure LGPLAcceptClick(Sender: TObject);
begin
WizardForm.NextButton.Enabled := LGPLAccept.Checked;
end;
[Files]
Source: {#Common}Setups\lgpl-3.0.txt; DestDir: {app}; Flags: ignoreversion
[CustomMessages]
LGPLHeader=Please read the following License Agreement. Some components are licensed under the GNU Lesser General Public License.