ReadOnly or Disabled-Grayed Task checkbox? - installation

I would like to disable and set to gray color, or set to readonly, some task checkboxes, the checkboxes that are checked in this image:
I'm not looking for other kind of approach, I want to make visible those Tasks but make their checkboxes uncheckeable, that's all, this way the user can see what is going to be installed and what is restricted by default.
My Install script looks like this:
[Tasks]
; VS Optional Features
Name: blend; Description: Blend; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: foundationclass; Description: Microsoft Foundation Classes for C++; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: lightswitch; Description: Microsoft LightSwitch; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: officedevelopertools; Description: Microsoft Office Developer Tools; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: sqldatatools; Description: Microsoft SQL Server Data Tools; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: webdevelopertools; Description: Microsoft Web Developer Tools; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: silverlightsdk; Description: SilverLight Developer Kit; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: Win8SDK; Description: Tools For Maintaining Store Apps For Windows 8; GroupDescription: VS Optional Features:; Flags: Unchecked
Name: WindowsPhone80; Description: Windows Phone 8.0 SDK; GroupDescription: VS Optional Features:; Flags: Unchecked
; VS Hidden Features
Name: netfx4; Description: .NET FX 4; GroupDescription: VS Hidden Features:
Name: netfx45; Description: .NET FX 4.5; GroupDescription: VS Hidden Features:
Name: bliss; Description: Bliss; GroupDescription: VS Hidden Features:
Name: helpviewer; Description: Microsoft Help Viewer 2.1; GroupDescription: VS Hidden Features:
Name: portablelibrary; Description: Microsoft Portable Library Multi-Targeting Pack; GroupDescription: VS Hidden Features:
Name: report; Description: Microsoft Report Viewer Add-On for Visual Studio 2013; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: silverlight; Description: Microsoft Silverlight 5 SDK; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqldac; Description: Microsoft SQL DAC; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqldom; Description: Microsoft SQL DOM; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqllocaldb; Description: Microsoft SQL Server 2013 Express LocalDB; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqlmanagementobjects; Description: Microsoft SQL Server 2013 Management Objects; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqlclr; Description: Microsoft SQL Server 2013 System CLR Types; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqltran; Description: Microsoft SQL Server 2013 Transact-SQL; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sqlce; Description: Microsoft SQL Server Compact Edition; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_compilers; Description: Microsoft Visual C++ 2013 Compilers; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_core; Description: Microsoft Visual C++ 2013 Core Libraries; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_debug; Description: Microsoft Visual C++ 2013 Debug Runtime; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_designtime; Description: Microsoft Visual C++ 2013 Designtime; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: c_extendedlibraries; Description: Microsoft Visual C++ 2013 Extended Libraries; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: intellitrace; Description: Microsoft Visual Studio 2013 IntelliTrace; GroupDescription: VS Hidden Features:
Name: storyboarding; Description: Microsoft Visual Studio Team Foundation Server 2013 Storyboarding; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: sdk3; Description: SDK Tools 3; GroupDescription: VS Hidden Features:
Name: sdk4; Description: SDK Tools 4; GroupDescription: VS Hidden Features:
Name: analytics; Description: Visual Studio Analytics; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: dotfuscator; Description: Visual Studio Dotfuscator; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: javascript; Description: Visual Studio Extensions for Windows Library for JavaScript; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: profiler; Description: Visual Studio Profiler; GroupDescription: VS Hidden Features:; Flags: Unchecked
Name: winsdk; Description: Windows Software Development Kit; GroupDescription: VS Hidden Features:; Flags: Unchecked
Is this possibly to accomplish?
I didn't found any Task flag that helps me to do this, in the other hand, I've seen other questions in StackOverflow but are related to readonly checkboxes and it uses pascal-script code, I'm not a pascal script code and I'm not sure whether that is what I need to do because I'm not creating and instancing manually the checkboxes in the Form, I mean that I don't have any control on those checkboxes+labels, I'm just adding tasks in the Task section.
UPDATE
I'm using the pascal-script code below to disable the desired items, but when I run my installer I get this error, it says that the index is out of bounds, why?, I'm using the proper chekbox indexes and I've verified the indexes seeying the resulting task page... I think that the problem is the wpSelectTasks, it is an integrated constant?, anyways I've tried to specify a constant with the pagenumber of the tasks page and I still get the same error, and the error occurs when I change the selected page using the 'Next' button (not 'Back'):
// Disable Tasks
procedure CurPageChanged(CurPageID: Integer);
begin
// if we have entered the tasks selection page, disable the specified Tasks.
if CurPageID = wpSelectTasks then
WizardForm.TasksList.ItemEnabled[11] := False;
WizardForm.TasksList.ItemEnabled[12] := False;
WizardForm.TasksList.ItemEnabled[13] := False;
WizardForm.TasksList.ItemEnabled[14] := False;
WizardForm.TasksList.ItemEnabled[15] := False;
WizardForm.TasksList.ItemEnabled[30] := False;
WizardForm.TasksList.ItemEnabled[32] := False;
WizardForm.TasksList.ItemEnabled[33] := False;
end;
// Disable Tasks - END
I have more code for UI customizations and I don't know if some thing is in conflict with the other procedure, the entire [Code] section is this:
[Code]
// Disable Tasks
procedure CurPageChanged(CurPageID: Integer);
begin
// if we have entered the tasks selection page, disable the specified Tasks.
if CurPageID = wpSelectTasks then
WizardForm.TasksList.ItemEnabled[11] := False;
WizardForm.TasksList.ItemEnabled[12] := False;
WizardForm.TasksList.ItemEnabled[13] := False;
WizardForm.TasksList.ItemEnabled[14] := False;
WizardForm.TasksList.ItemEnabled[15] := False;
WizardForm.TasksList.ItemEnabled[30] := False;
WizardForm.TasksList.ItemEnabled[32] := False;
WizardForm.TasksList.ItemEnabled[33] := False;
end;
// Disable Tasks - END
// Installer UI Customizations
const
Custom_Height = 570;
Page_Color = $7b2b68;
Page_Color_Alternative1 = clblack;
Page_Color_Alternative2 = clwhite;
Font_Color = $fffbff;
var
DefaultTop,
DefaultLeft,
DefaultHeight,
DefaultBackTop,
DefaultNextTop,
DefaultCancelTop,
DefaultBevelTop,
DefaultOuterHeight: Integer;
procedure InitializeWizard();
begin
DefaultTop := WizardForm.Top;
DefaultLeft := WizardForm.Left;
DefaultHeight := WizardForm.Height;
DefaultBackTop := WizardForm.BackButton.Top;
DefaultNextTop := WizardForm.NextButton.Top;
DefaultCancelTop := WizardForm.CancelButton.Top;
DefaultBevelTop := WizardForm.Bevel.Top;
DefaultOuterHeight := WizardForm.OuterNotebook.Height;
// Page sizes
WizardForm.Height := Custom_Height;
WizardForm.InnerPage.Height := WizardForm.InnerPage.Height + (Custom_Height - DefaultHeight);
WizardForm.LicensePage.Height := WizardForm.LicensePage.Height + (Custom_Height - DefaultHeight);
// Control locations
WizardForm.BackButton.Top := DefaultBackTop + (Custom_Height - DefaultHeight);
WizardForm.Bevel.Top := DefaultBevelTop + (Custom_Height - DefaultHeight);
WizardForm.CancelButton.Top := DefaultCancelTop + (Custom_Height - DefaultHeight);
WizardForm.LicenseAcceptedRadio.Top := WizardForm.LicenseAcceptedRadio.Top + (Custom_Height - DefaultHeight);
WizardForm.LicenseNotAcceptedRadio.Top := WizardForm.LicenseNotAcceptedRadio.Top + (Custom_Height - DefaultHeight);
WizardForm.NextButton.Top := DefaultNextTop + (Custom_Height - DefaultHeight);
WizardForm.Top := DefaultTop - (Custom_Height - DefaultHeight) div 2;
// Control Sizes
WizardForm.InfoBeforeMemo.Height := (Custom_Height - (DefaultHeight / 2));
WizardForm.InnerNotebook.Height := WizardForm.InnerNotebook.Height + (Custom_Height - DefaultHeight);
WizardForm.LicenseMemo.Height := WizardForm.LicenseMemo.Height + (Custom_Height - DefaultHeight);
WizardForm.OuterNotebook.Height := WizardForm.OuterNotebook.Height + (Custom_Height - DefaultHeight);
WizardForm.Taskslist.Height := (Custom_Height - (DefaultHeight / 2));
WizardForm.WizardBitmapImage.Height := (Custom_Height - (DefaultHeight / 5));
// Page colos
WizardForm.color := Page_Color_Alternative1;
WizardForm.FinishedPage.Color := Page_Color;
WizardForm.InfoBeforeMemo.Color := clGray;
WizardForm.InnerPage.Color := Page_Color;
WizardForm.LicensePage.Color := Page_Color;
WizardForm.MainPanel.Color := Page_Color;
WizardForm.SelectComponentsPage.Color := Page_Color;
WizardForm.SelectDirPage.Color := Page_Color;
WizardForm.Taskslist.Color := Page_Color;
WizardForm.WelcomePage.color := Page_Color;
// Font colors
WizardForm.Font.color := Font_Color;
//WizardForm.InfoBeforeMemo.font.Color := Font_Color;
WizardForm.Licensememo.font.Color := Font_Color;
WizardForm.MainPanel.font.Color := Font_Color;
WizardForm.PageDescriptionLabel.font.color := Font_Color;
WizardForm.PageNameLabel.font.color := Font_Color;
WizardForm.Taskslist.font.Color := Font_Color;
WizardForm.WelcomeLabel1.font.color := Font_Color;
WizardForm.WelcomeLabel2.font.color := Font_Color;
end;
// Installer UI Customizations - END

The current solution for this, is specified by a #Tlama's answer in this question.

Related

Inno Setup: turning exclusive Tasks into radio boxes

I'm working on an Inno Setup installer that has 4 radio boxes to let the user select which "flavor" they want to install. The documentation left me confused; should I use Tasks, Types, or Components for that?
It seems Tasks have radio-button behavior built-in: when the exclusive flag is set, only one of the tasks can be selected at a time. That's exactly what I want. So I have this code:
[Tasks]
Name: variant-a; Description: "A"; GroupDescription: "Variant"; Flags: exclusive
Name: variant-b; Description: "B"; GroupDescription: "Variant"; Flags: exclusive unchecked
Name: variant-c; Description: "C"; GroupDescription: "Variant"; Flags: exclusive unchecked
Name: variant-d; Description: "D"; GroupDescription: "Variant"; Flags: exclusive unchecked
How can I make the radio buttons show up? And how do I get the value of the Task that was chosen (e.g. "variant-a")?
The best is to use an existing script and see how it works
The documentation left me confused; should I use Tasks, Types, or
Components for that?
The added code parts have both : Task and Components
So decide what is more useful for your project.
In the examples directory are many useful examples that are well suited to respond to user input.
Copy the ..:...\Inno Setup 5\Examples\CodeExample1.iss to CodeExample1_ex.iss.
Open the copied file and insert the following code fragments.
Search for
OutputDir=userdocs:Inno Setup Examples Output
Insert below
//OutputDir=userdocs:Inno Setup Examples Output
[Tasks]
Name: variant_a; Description: "A"; GroupDescription: "Variant"; Components: main\a; Flags: exclusive
Name: variant_b; Description: "B"; GroupDescription: "Variant"; Components: main\b; Flags: exclusive unchecked
Name: variant_c; Description: "C"; GroupDescription: "Variant"; Components: main\c; Flags: exclusive unchecked
Name: variant_d; Description: "D"; GroupDescription: "Variant"; Components: main\d; Flags: exclusive unchecked
; Disabled we need it later -----------------------------------------------------
;Name: variant_a; Description: "A"; GroupDescription: "Variant"; Flags: exclusive
;Name: variant_b; Description: "B"; GroupDescription: "Variant"; Flags: exclusive unchecked
;Name: variant_c; Description: "C"; GroupDescription: "Variant"; Flags: exclusive unchecked
;Name: variant_d; Description: "D"; GroupDescription: "Variant"; Flags: exclusive
[Types]
Name: "full"; Description: "Full installation"
Name: "compact"; Description: "Compact installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
Name: "help"; Description: "Help File"; Types: full
Name: "readme"; Description: "Readme File"; Types: full
Name: "readme\en"; Description: "English"; Flags: exclusive
Name: "readme\de"; Description: "German"; Flags: exclusive
Name: "main"; Description: "variants"; Types: custom
Name: "main\a"; Description: "variant_a"; Types: custom; Flags: exclusive
Name: "main\b"; Description: "variant_b"; Types: custom; Flags: exclusive
Name: "main\c"; Description: "variant_c"; Types: custom full; Flags: exclusive
Name: "main\d"; Description: "variant_d"; Types: custom; Flags: exclusive
Search for the [Code] and add I : integer;
[Code]
var
MyProgChecked: Boolean;
MyProgCheckResult: Boolean;
FinishedInstall: Boolean;
I : integer;
Search for
procedure CurPageChanged(CurPageID: Integer);
Insert below
//procedure CurPageChanged(CurPageID: Integer);
var
Addtxt,WFCaption,WSelCaption : String;
Search for
Log('CurPageChanged(' + IntToStr(CurPageID) + ') called');
Insert below
//Log('CurPageChanged(' + IntToStr(CurPageID) + ') called');
if CurPageID = wpSelectComponents then begin
WFCaption := WizardForm.ComponentsList.ItemCaption[8];
Addtxt := ' <---------- If I where you I would take this';
if Pos(Addtxt,WFCaption) = 0 then WizardForm.ComponentsList.ItemCaption[8] := WFCaption + Addtxt;
end;
if CurPageID = wpSelectTasks then
begin
{ Only now is the TasksList populated }
if WizardForm.TasksList.Items.Count = 2 then begin
WSelCaption := Copy(WizardForm.TasksList.ItemCaption[1],1,2); //else
if Pos('C',WizardForm.TasksList.ItemCaption[1]) > 0 then
WSelCaption := WSelCaption + ' <-------- Your choice, my favorite, thank you :-)'#13#10+
' Not correct? Please go back and change the selection' else
WSelCaption := WSelCaption + ' <-------- Your choice : Not correct? Please go back and change the selection';
WizardForm.TasksList.ItemEnabled[0] := False;
WizardForm.TasksList.ItemCaption[1] := WSelCaption;
end else begin
For I := 1 to WizardForm.TasksList.Items.Count -1 do begin
if WizardForm.TasksList.Checked[I] then begin
WizardForm.TasksList.ItemCaption[I] := Copy(WizardForm.TasksList.ItemCaption[I],1,2) +
' <-------- Your choice : Not correct? Please change the selection';
end;
end; // for
end;
end;
Next are the constants used for the CurPageID
Example:
if CurPageID = wpSelectComponents then begin
wpWelcome, wpLicense, wpPassword, wpInfoBefore wpUserInfo,
wpSelectDir, wpSelectComponents wpSelectProgramGroup, wpSelectTasks,
wpReady wpPreparing, wpInstalling, wpInfoAfter, wpFinished
Change the individual code sections and look at the result.
It is easier and quicker to achieve results that are traceable.
Version A:
and the Task List result.
Why the trick with the .ComponentsList?
You do not need an extra event.
It is selected in the .ComponentsList and Controlled in the .Taskslist.
If you select nothing the .Taskslist is not visible.
All without extra code in the [Code] section.
Now we try Version B
Go to the [Task] section and look for
; Disabled we need it later -----------------------------------------------------
Disable the first four lines and enable the next four lines.
Search for procedure CurPageChanged(CurPageID: Integer);
Add above the Event WizardForm.TasksList.OnClickCheck := #TaskListClickCheck;
and the procedure for the .TasksList.
Here goes what you need to capture the selected value.
How or what you do with the Event WizardForm.TasksList.OnClickCheck and the freely selectable name of the function here : procedure TaskListClickCheck(Sender: TObject); depends on the requirements you want to achieve.
procedure TaskListClickCheck(Sender: TObject);
begin
For I := 1 to WizardForm.TasksList.Items.Count -1 do begin
if WizardForm.TasksList.Checked[I] then
WizardForm.TasksList.ItemCaption[I] := Copy(WizardForm.TasksList.ItemCaption[I],1,2) +
' <-------- Your choice : Not correct? Please change the selection' else
WizardForm.TasksList.ItemCaption[I] := Copy(WizardForm.TasksList.ItemCaption[I],1,2);
end;
end;
procedure InitializeWizard();
begin
WizardForm.TasksList.OnClickCheck := #TaskListClickCheck;
end;
//procedure CurPageChanged(CurPageID: Integer);
Now we need an event to intercept the selection.
Without extra code, the selection is always "A".
At last put before the final list, a little late right?
The user thought he was almost done!
The Name: "main"; Description: "variants"; Types: custom etc. part of the .ComponentsList is useless now. Best to disable it also.
Where can you find all this information?
Look at the Inno Setup help.
Search for WizardForm.TasksList
There we can see the property TasksList: **TNewCheckListBox**; read;
(Used Properties are blue)
So we click on TNewCheckListBox and get.
One or the other we can get a bit easier (direct way: value of a variable).
But here I did not want to make it too complicated and not use directly which only contributes to confusion.
Just using an existing code in an already existing script I do not understand as a code wrighting service.
To understand it only as an initial aid.

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.

using Desktop App Converter sticks at "Waiting for installer process to complete inside Isolated Environment"

I am trying to convert an Install .exe file I made with inno-setup to an appx file using the Desktop App Converter from Microsoft. It hangs every time at "Waiting for installer to process to complete inside Isolated Environment".
The command that I am using in Desktop App Converter is:
DesktopAppConverter.exe -Installer "C:\Users\Desktop\Output\setup.exe" -Destination "C:\Users\Desktop\MyProgram\" -PackageName "MyProgramApps" -Publisher "Me"
-Version 0.1.4.0 -MakeAppx -Verbose -InstallerArguments "/VERYSILENT" -PackagePublisherDisplayName "MyApps" -PackageDisplayName "MyProgram" -AppDisplayName "MyProgram" -AppId "MyProgram"
When I run "MyProgram.exe from the command line using "/VERYSILENT" it installs completely silently.
The script from Inno-Setup is:
#define MyAppName "MyProgram"
#define MyAppVersion "0.1.7"
#define MyAppPublisher "MyApps"
#define MyAppExeName "MyProgram.exe"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=C:\Users\Desktop\Output
OutputBaseFilename=thirteenth_setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\Desktop\resources\MyProgram.exe"; DestDir: "{app}"; Flags: ignoreversion
#define JavaInstaller "jre-8u151-windows-x64.exe"
Source: "{#JavaInstaller}"; DestDir: "{tmp}"; Flags: dontcopy
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; \
Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&', '&&' )}}"; \
Flags: nowait postinstall skipifsilent
[Code]
const
REQUIRED_JAVA_VERSION = '1.7';
function isJavaInstalled(): Boolean;
var
JavaVer : String;
tmpFileName,
pathJavaExe: String;
isGoodJavaVersion,
isFoundJavaPath: Boolean;
ResultCode: Integer;
ExecStdout: AnsiString;
begin
{ *** check in registry }
{ sets variables: }
{ JavaVer }
{ isGoodJavaVersion }
if RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment',
'CurrentVersion', JavaVer) AND (JavaVer <> '') OR
RegQueryStringValue(HKLM64, 'SOFTWARE\JavaSoft\Java Runtime Environment',
'CurrentVersion', JavaVer) AND (JavaVer <> '') then begin
Log('* Java Entry in Registry present. Version: ' + JavaVer);
isGoodJavaVersion := CompareStr(JavaVer, REQUIRED_JAVA_VERSION) >= 0;
end;
{ add additional checks, for example by searching the PATH, }
{ or by running `java -version` }
Result := isGoodJavaVersion;
end;
procedure ExtractInstaller;
begin
ExtractTemporaryFile('{#JavaInstaller}');
end;
[Run]
Filename: "{tmp}\{#JavaInstaller}"; Parameters: "SPONSORS=0"; \
StatusMsg: "Java Runtime Enviroment not installed on your system. Installing..."; \
Check: not isJavaInstalled; BeforeInstall: ExtractInstaller;
I think it has something to do with:
[Run]
Filename: "{tmp}\{#JavaInstaller}"; Parameters: "SPONSORS=0"; \
StatusMsg: "Java Runtime Enviroment not installed on your system. Installing..."; \
Check: not isJavaInstalled; BeforeInstall: ExtractInstaller;
because when I run it without that 'run' statement then DAC runs to a finish. But of course then the Java installer does not run.
You can also convert the packages with the new free Express edition from Advanced Installer, developed in partnership with Microsoft, its purpose is to complement the Desktop App Converter.
For example, the installation of your INNO package can be interactive, with UI, so you can manually run the installer and complete the installation, thus should be able to avoid the above problem.
It has a GUI that allows for advanced customization of the APPX packages, without requiring you to have knowledge about the internals package schemas.
If you have any questions about it, let me know, would love to help.
Disclaimer: I work on the team that builds Advanced Installer.

Do not let user install specific component, if another is already installed

Very new to InnoSetup, but I could not find any documentation on this. I would like to implement a condition where if the user has already installed a specific component, it will not allow them to install another specific component.
For example: If Bob has previously installed ComponentA, and ties to install ComponentB, it will error our with a warning "Cannot install ComponentB while ComponentA currently installed"
This is what I have come up with so far:
procedure CurPageChanged(CurPageID: Integer);
var
Value: string;
UninstallKey: string;
begin
UninstallKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
ExpandConstant('{#SetupSetting("AppId")}') + '_is1';
Result := (RegQueryStringValue(HKLM, UninstallKey, 'Inno Setup: Selected Components', Value) or
RegQueryStringValue(HKCU, UninstallKey, 'Inno Setup: Selected Components', Value)) and (Value <> '');
if CurPageID = wpSelectComponents then
if Result = WizardForm.ComponentsList.ItemCaption[1] then
begin
WizardForm.ComponentsList.Checked[1] := False;
WizardForm.ComponentsList.ItemEnabled[1] := True;
WizardForm.ComponentsList.Checked[2] := False;
WizardForm.ComponentsList.ItemEnabled[2] := False;
WizardForm.ComponentsList.Checked[3] := False;
WizardForm.ComponentsList.Enabled[3] := True;
end;
end;
end;
I know I do not quite have the Registry Query exactly right for selected components.. I feel like I'm close though. The problem is, Result may have multiple components in it. like (apple,orange,mango) but I want the statement to still be true if just "mango" exists.
Think you could do this in another way:
Use Flags:
exclusive
example:
[Types]
Name: "full"; Description: "Full"; Flags: iscustom
[Components]
Name: "connect"; Description: "Mainsection"; Types: "full" ;Flags: fixed
Name: "connect\compA"; Description: "ComponentA"; Types: "full"; Flags: exclusive
Name: "connect\compB"; Description: "ComponentB"; Flags: exclusive
[Files]
Source: "srcpath"; DestDir: "dirpath"; Components: connect\compA
Source: "srcpath"; DestDir: "dirpath"; Components: connect\compB
It looks like this
So if "Bob" wants to choose componenB he can not use ComponentA without automatic deselect componentB
So now if "Bob" already installed ComponentA and wants to install ComponentB and u dont want that both components are installed u need to use installdelete
example:
[InstallDelete]
Type: filesandordirs; Name: "dirpath\compA"; Components: connect\compB;
Type: filesandordirs; Name: "dirpath\compB"; Components: connect\compA;
I hope this will help

How to separate a Inno Setup script into multiple files?

I have two setup scripts that share common code. It is possible to refactor them?
One way of doing that is having a file for common code which will be referenced by each script.
Is this possible?
Depending on the version of InnoSetup you are using, you can use an include file. The example below uses three files (main.iss, code.iss, commonfiles.iss):
Main File:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "My Program"
#define MyAppVerName "My Program 1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\util\innosetup\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
#include "CommonFiles.iss"
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#MyAppName}}"; Flags: nowait postinstall skipifsilent
#include "code.iss"
CommonFiles.iss:
Source: "Common.DLL"; DestDir: "{app}"; Flags: ignoreversion
Code.iss:
[code]
function IsDotNET11Detected(): boolean;
// Indicates whether .NET Framework 1.1 is installed.
var
success: boolean;
install: cardinal;
begin
success := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'Install', install);
Result := success and (install = 1);
end;
function InitializeSetup(): Boolean;
begin
if not IsDotNET11Detected then begin
MsgBox('This software requires the Microsoft .NET Framework 1.1.'#13#13
'Please use Windows Update to install this version,'#13
'and then re-run the setup program.', mbInformation, MB_OK);
Result := false;
end else
begin
MsgBox('Framework installed',mbInformation, MB_OK);
Result := true;
end
end;

Resources