简体   繁体   English

Inno设置 - 如何在安装Google Chrome时告知安装,它应该打开stackoverflow.com?

[英]Inno Setup - How can I tell the installation when it execute Google Chrome, it should open stackoverflow.com?

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

  • 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) http://ninite.com/chrome/获取他们的Chrome安装程序(但这并没有帮助我,因为我需要在安装Google Chrome后最终打开一个特定的网站)

  • Now I am trying to use Inno Setup myself, to make sure I have almost same as Ninite 现在我正在尝试自己使用Inno Setup,以确保我和Ninite几乎相同

  • once Inno Setup is done with Google Chrome installation, how can I make sure to open www.stackoverflow.com with Google Chrome? 一旦Inno Setup完成Google Chrome安装,我如何确保使用Google Chrome打开www.stackoverflow.com?

Here is my code of Inno Setup, not doing correctly in point 3: 这是我的Inno Setup代码,在第3点没有正确执行:

  1. installing Google Chrome 安装Google Chrome

  2. after install executing Google Chrome 安装执行谷歌浏览器后

  3. BUT how can I tell the Google Chrome - execute that first link: www.stackoverflow.com? 但我如何告诉谷歌浏览器 - 执行第一个链接: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:\Users\sun\Desktop\Nieuwe 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 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\sun\Downloads\ChromeSetup (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

The following might work, since the registry key I'm referring to, is described in the official docs for the Chrome installer. 以下可能有效,因为我所指的注册表项在Chrome安装程序的official docs有所描述。 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. 有一个注册表项直接包含chrome.exe文件的路径,因此它是恕我直言,是获取Chrome应用程序的最佳选择。 file name. 文档名称。 It is this key: 这是关键:

<root>\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe

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. 其中<root>HKEY_LOCAL_MACHINEHKEY_CURRENT_USER注册表根目录,具体取决于是为当前用户安装了Chrome还是为整个系统安装了Chrome。

In the following script I'm using the above key not only for getting the Chrome app. 在以下脚本中,我使用上述密钥不仅可以获取Chrome应用。 file name, but even for determining if the Chrome is installed: 文件名,但即使是用于确定Chrome是否已安装:

[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 = 'Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Inno Setup - 如何设置安装文件夹的权限 - Inno Setup - How to set permissions of installation folder 如何在Inno Setup中引用文件关联的自定义图标? - How can I reference a custom icon for a file association in Inno Setup? 如何在目标机器上重现 Inno Setup 中的符号链接? - How can I reproduce symbolic link in Inno Setup on the target machine? 谷歌浏览器如何在下载后自动执行安装? - How does Google Chrome manage to execute installation automatically after download? 使用Inno Setup运行静默安装时输入序列号? - Input serial number when running silent installation with Inno Setup? Inno Setup驱动程序安装API - Inno Setup driver installation APIs 如何告诉chrome.app.window在Windows下的特定屏幕上打开? - How can I tell a chrome.app.window to open on a specific screen under Windows? Inno Setup,如何将安装限制为特定的硬件配置? - Inno Setup, How to restrict installation to specific hardware configuration? 通过Inno Setup运行安装的应用程序时如何关闭设置窗口? - How to close setup window when running installed application by Inno Setup? 当值仅使用默认名称时,如何在Inno Setup中获取注册表值? - How do I get a registry value in Inno Setup when the value only uses the default name?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM