2016-11-30 107 views
1

我们有一个需要谷歌浏览器版本为54.00及以上版本的软件。使用Inno Setup检查Chrome是否安装并且是特定版本

因此,我想让我的应用程序安装脚本首先检查浏览器是否在计算机上可用,如果它不是它们,那么它应该静默安装离线版本54.00(Chrome离线安装文件将是如果在计算机中已经安装了chrome,那么安装脚本应该检查chrome版本是否为54.00或更高,如果是,那么如果版本低于54.00,则应该继续进行软件安装;否则,应该从包中提供的chrome安装文件安装或更新到v54.00。

这个检查铬安装应该在我的软件安装过程的开始。

此外,如果有人和帮助我关于inno的任何教程,可以在网上以一个小细节的方式可用,将帮助我很多。

其中我们有

本安装脚本如下: -

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 
+0

好的,谢谢编辑。我的回答是否有帮助? –

+0

@martin,我无法测试你的答案,因为我感到困惑,应该在哪里放置代码,以及我应该在哪里调用该函数。所以我已经添加了我的脚本,请你帮我解决这个问题。由于我对新设置没有设置 –

+0

我已经给我的答案添加了一个呼叫示例。 –

回答

0

你的问题是相当广泛的,它没有指定,在要检查并安装Chrome安装的哪一部分,等等。

但给你一些想法,请参阅下面的代码。

代码使用从Inno Setup - How can I tell the installation when it execute Google Chrome, it should open stackoverflow.com?即回答也是GetChromeFileName函数显示了一个不同的方法来检查Chrome和执行其安装程序,使用[Run]部条目和Check参数。

[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; 

调用CheckChrome,在你需要它。例如。在InitializeSetupCurStepChanged

function InitializeSetup(): Boolean; 
begin 
    CheckChrome; 
    Result := True; 
end; 
+0

它说编译和编译时未知标识符“GetChromeFileName”没有完成 –

+0

正如响应中所述,函数来自链接的响应。 –

+0

那么我怎样才能摆脱那个错误 –

相关问题