1

We have a software that need google chrome version 54.00 and above.

Hence i want to make my application installation script to first check if the chrome browser is available or not in the computer then if it is not their then it should silently install the chrome version 54.00 offline(chrome offline installation file will be provided in the package it self), if the chrome is already installed in the computer then the installation script should check if the chrome version is 54.00 and above if yes then our software installation should be proceeded else if the version is lower than 54.00 then it should install or update to v54.00 from the chrome setup file provided in the package.

This check for the chrome installation should be at the start of the installation process of my software.

Also if anybody and help me with any tutorial about inno that is available online in a little detail manner will help me a lot.

The present installation script which we are having is as below :-

enter center code herode here
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "CLIxModules_v1.0.9"
#define MyAppVersion "1.0.9"
#define MyAppPublisher "Connected Learning Initiative, Tata Institute Of  Social Science"
#define MyAppURL "https://clix.tiss.edu" 
#define MyAppExeName "unplatform_win32_ssl.bat"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{2154FF98-4E99-44A6-9EE9-56886A9BA8EF}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={userdocs}\{#MyAppName}
DisableProgramGroupPage=yes
OutputDir=A:\CLIX\FINAL RELEASED VERSIONS\Release1811
OutputBaseFilename=CLIxModules_v1.0.9_setup
SetupIconFile=A:\CLIX\Packaged\CLIxModules_v1.0.9_Packaged_1711\CLIxModules_v1.0.9\Clix_Setup_Icon.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";   GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "A:\CLIX\Packaged\CLIxModules_v1.0.9_Packaged_1711\CLIxModules_v1.0.9\unplatform_win32_ssl.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "A:\CLIX\Packaged\CLIxModules_v1.0.9_Packaged_1711\CLIxModules_v1.0.9\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: {app}/clix_round_icons_core_RFY_icon.ico

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent
Tejas Shah
  • 55
  • 9

1 Answers1

0

Your question is pretty broad, it does not specify, in what part of the installation you want to check for and install Chrome, etc.

But to give you some idea, see the code below.

The code uses the GetChromeFileName function from Inno Setup - How can I tell the installation when it execute Google Chrome, it should open stackoverflow.com? That answer also shows a different approach to checking for Chrome and executing its installer, using the [Run] section entry and the Check parameter.

[Files]
Source: "ChromeStandaloneSetup64.exe"; Flags: dontcopy nocompression

[Code]

procedure CheckChrome;
var
  ChromeMS, ChromeLS: Cardinal;
  ChromeMajorVersion, ChromeMinorVersion: Cardinal;
  InstallChrome: Boolean;
  ChromeFileName: string;
  ChromeInstallerFileName: string;
  ResultCode: Integer;
begin
  ChromeFileName := GetChromeFileName('');
  if ChromeFileName = '' then
  begin
    Log('Chrome not found, will install');
    InstallChrome := True;
  end
    else
  begin
    Log(Format('Found Chrome path %s', [ChromeFileName]));
    if not GetVersionNumbers(ChromeFileName, ChromeMS, ChromeLS) then
    begin
      Log(Format('Cannot read Chrome version from %s, will install', [ChromeFileName]));
      InstallChrome := True;
    end
      else
    begin
      ChromeMajorVersion := ChromeMS shr 16;
      ChromeMinorVersion := ChromeMS and $FFFF;
      Log(Format('Chrome version is %d.%d', [ChromeMajorVersion, ChromeMinorVersion]));
      if ChromeMajorVersion < 53 then
      begin
        Log('Chrome is too old, will install');
        InstallChrome := True;
      end
        else
      begin
        Log('Chrome is up to date, will not install');
        InstallChrome := False;
      end;
    end;
  end;

  if InstallChrome then
  begin
    Log('Installing Chrome');
    ExtractTemporaryFile('ChromeStandaloneSetup64.exe');
    ChromeInstallerFileName := ExpandConstant('{tmp}\ChromeStandaloneSetup64.exe');
    Exec(ChromeInstallerFileName, '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
    { add some error checking here}
    Log('Installed Chrome');
  end;
end;

Call the CheckChrome, where you need it. E.g. in InitializeSetup or CurStepChanged:

function InitializeSetup(): Boolean;
begin
  CheckChrome;
  Result := True;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992