How to show several licenses in the installer - installation

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.

Related

Custom TLabel not displaying on FinishedPage in Inno Setup

I must be missing something obvious here. I'm trying to add a link to the release notes onto wpFinished but can't seem to make it show up:
I have a file finishedPage.iss which I include via #include "InnoDialogs\finishedPage.iss";
The file has the following content:
[Run]
Filename: "{app}\bin\{#MyAppExeName}"; \
Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; \
Flags: nowait postinstall skipifsilen
[Code]
{ procedures to deal with page interaction }
procedure ReleaseNotesClick(Sender: TObject);
var
errorCode: Integer;
begin
ShellExec('','https://myUrl.com/Release_Notes', '', '', SW_SHOW, ewNoWait, errorCode)
end;
{ build the page }
procedure FinishedPage_Create;
var
ReleaseNotesLink: TLabel;
begin
ReleaseNotesLink := TLabel.Create(WizardForm);
ReleaseNotesLink.Parent := WizardForm.FinishedPage;
ReleaseNotesLink.Caption := 'Read the Releasenotes';
ReleaseNotesLink.Enabled := True;
ReleaseNotesLink.Visible := True;
ReleaseNotesLink.AutoSize := True;
ReleaseNotesLink.Left := WizardForm.FinishedLabel.Left;
ReleaseNotesLink.Top := WizardForm.FinishedLabel.Top + ScaleY(100);
ReleaseNotesLink.OnClick := #ReleaseNotesClick;
ReleaseNotesLink.ParentFont := True;
ReleaseNotesLink.Font.Style := ReleaseNotesLink.Font.Style + [fsUnderline, fsBold];
ReleaseNotesLink.Font.Color := clBlue;
ReleaseNotesLink.Cursor := crHand;
end;
In the CurPageChanged procedure in my main installer file I have:
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
FinishedPage_Create();
end;
end;
This compiles just fine, but I can't make it show up. I tried different positions as well, thinking perhaps it's just drawn behind something else. I'm using the same procedure for adding elements to other pages...
Any ideas what I'm missing?
Your label is hidden behind the RunList, which occupies the rest of the page.
You have to shrink the list. For example:
WizardForm.RunList.Height := ScaleY(24);
ReleaseNotesLink.Left := WizardForm.RunList.Left;
ReleaseNotesLink.Top := WizardForm.RunList.Top + WizardForm.RunList.Height + ScaleY(8);

Inno Setup Jumps to Second Page if Program is Installed [duplicate]

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.

Inno Setup : The Installed Program Never Launches after Setup Completion

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.

Radiobuttons with InnoSetup : Define files that will be installed or not

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

Inno Setup: How to change Messages at runtime?

I need to change Messages at runtime. I have a AfterInstall procedure that checks to see if a bat file was successful. If it is not, I want to change the value of ExitSetupMessage just before calling WizardForm.Close. I was hoping to do something like this english.ExitSetupMessage := 'THIS IS THE PART THAT DOES NOT WORK';. Code examples would be appreciated. Thank you.
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Files]
Source: {src}\test.bat; DestDir: {tmp}; AfterInstall: ValidateInstall
[Code]
procedure ValidateInstall();
var
ResultCode : Integer;
begin
if not Exec(ExpandConstant('{tmp}\test.bat'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
english.ExitSetupMessage := 'THIS IS THE PART THAT DOES NOT WORK';
WizardForm.Close;
end;
end;
I don't know of a way to change the messages at runtime.
However in the case you posted I know of a workaround. You would set your CustomState before calling WizardForm.Close
var
CustomState : Boolean;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
var
Msg : String;
Res : Integer;
begin
Confirm := False; // Don't show the default dialog.
// Chose which message the custom or default message.
if CustomState then
Msg := 'My Custom Close Message'
else
Msg := SetupMessage(msgExitSetupMessage);
//as the Question
Res := MsgBox(Msg, mbConfirmation,MB_OKCANCEL);
// If they press OK then Cancel the install
Cancel := (Res = IDOK);
end;
The side effect is you lose the Exit Setup? title of the dialog box.
You can use function ExitSetupMsgBox: Boolean; when you don't want to change the message
to keep the title around.
According to http://www.jrsoftware.org/ishelp/index.php?topic=scriptclasses
it should be
WizardForm.FinishedLabel.Caption := 'Desired text goes here';

Resources