Inno Setup - 当它执行 Google Chrome 时,我如何告诉安装,它应该打开 stackoverflow.com? [英] Inno Setup - How can I tell the installation when it execute Google Chrome, it should open stackoverflow.com?

查看:13
本文介绍了Inno Setup - 当它执行 Google Chrome 时,我如何告诉安装,它应该打开 stackoverflow.com?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过以下方式:https://productforums.google.com/forum/#!topic/chrome/8XnSOnhLBzA

  • http://ninite.com/chrome/ 获取他们的 chrome 安装程序(但这对我没有帮助,因为一旦安装了 Google Chrome,我最终需要打开一个特定的网站)

  • Went to http://ninite.com/chrome/ to get their chrome installer (but that's not helping me cause I need to at the end open a specific Website once the Google Chrome is installed)

现在我正在尝试自己使用 Inno Setup,以确保我与 Ninite 几乎相同

Now I am trying to use Inno Setup myself, to make sure I have almost same as Ninite

使用 Google Chrome 安装完成 Inno Setup 后,如何确保使用 Google Chrome 打开 www.stackoverflow.com?

once Inno Setup is done with Google Chrome installation, how can I make sure to open www.stackoverflow.com with Google Chrome?

这是我的 Inno Setup 代码,在第 3 点中没有正确执行:

Here is my code of Inno Setup, not doing correctly in point 3:

  1. 安装谷歌浏览器

  1. installing Google Chrome

安装后执行谷歌浏览器

但是我如何告诉 Google Chrome - 执行第一个链接:www.stackoverflow.com?

BUT how can I tell the Google Chrome - execute that first link: www.stackoverflow.com?

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "ChromeSetup (1).exe"

[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={{FCF7940A-D96F-4A7A-9C69-C9DFE8BB308A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=C:UserssunDesktopNieuwe map
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:Program Files (x86)Inno Setup 5ExamplesMyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:UserssunDownloadsChromeSetup (1).exe"; DestDir: "{app}"; Flags: ignoreversion
; 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,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

推荐答案

以下可能有效,因为我所指的注册表项在 official docs 用于 Chrome 安装程序.有一个注册表项直接包含 chrome.exe 文件的路径,因此恕我直言,这是获取 Chrome 应用程序的最佳选择.文件名.就是这把钥匙:

The following might work, since the registry key I'm referring to, is described in the official docs for the Chrome installer. There is one registry key which directly contains a path to the chrome.exe file so it's IMHO the best choice to get the Chrome app. file name. It is this key:

<root>SoftwareMicrosoftWindowsCurrentVersionApp Pathschrome.exe

其中 <root>HKEY_LOCAL_MACHINEHKEY_CURRENT_USER 注册表根目录,具体取决于是否为当前用户安装了 Chrome 或全局用于整个系统.

Where the <root> is either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER registry root depending on whether the Chrome has been installed for the current user or globally for the whole system.

在以下脚本中,我使用上述密钥不仅是为了获取 Chrome 应用程序.文件名,但即使用于确定是否安装了 Chrome:

In the following script I'm using the above key not only for getting the Chrome app. file name, but even for determining if the Chrome is installed:

[Files]
Source: "chrome_installer.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

[Run]
Filename: "{tmp}chrome_installer.exe"; Check: not IsChromeInstalled
Filename: "{code:GetChromeFileName}"; Parameters: "www.stackoverflow.com"; 
    Check: IsChromeInstalled

[Code]
const
  ChromeAppRegKey = 'SoftwareMicrosoftWindowsCurrentVersionApp Pathschrome.exe';

function IsChromeInstalled: Boolean;
begin
  { check if there's the Chrome app registration entry under the HKCU, or }
  { HKLM root key, return the result }
  Result := RegKeyExists(HKEY_CURRENT_USER, ChromeAppRegKey) or
    RegKeyExists(HKEY_LOCAL_MACHINE, ChromeAppRegKey);
end;

function GetChromeFileName(Value: string): string;
var
  S: string;
begin
  { initialize returned value to an empty string }
  Result := '';
  { first attempt to read the Chrome app file name from the HKCU root key; }
  { if that fails, try to read the same from HKLM; if any of that succeed, }
  { return the obtained registry value }
  if RegQueryStringValue(HKEY_CURRENT_USER, ChromeAppRegKey, '', S) or
    RegQueryStringValue(HKEY_LOCAL_MACHINE, ChromeAppRegKey, '', S)
  then
    Result := S;
end;

这篇关于Inno Setup - 当它执行 Google Chrome 时,我如何告诉安装,它应该打开 stackoverflow.com?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆