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

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

问题描述

遵循以下步骤: https://productforums.google.com/forum /#!topic / chrome / 8XnSOnhLBzA




  • 去到 http://ninite.com/chrome/ ,以获得他们的Chrome安装程序(但这不是帮助我,因为我需要在最后打开一个特定的网站谷歌浏览器已安装)

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


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


  • ul>

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


    1. 在安装谷歌浏览器后安装Google Chrome


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






     ;由Inno Setup Script Wizard生成的脚本。 
    ;查看文档以获取创建入门设置脚本文件的详细信息!

    #define MyAppNameMy Program
    #define MyAppVersion1.5
    #define MyAppPublisherMy Company,Inc.
    #define MyAppURLhttp://www.example.com/
    #define MyAppExeNameChromeSetup(1).exe

    [设置]
    ;注:AppId的值唯一标识此应用程序。
    ;不要在其他应用程序的安装程序中使用相同的AppId值。
    ; (要生成新的GUID,请单击IDE中的工具|生成GUID。)
    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 =设置
    压缩= lzma
    SolidCompression =是

    [语言]
    名称:english; MessagesFile:compiler:Default.isl

    [任务]
    名称:desktopicon;说明:{cm:CreateDesktopIcon}; GroupDescription:{cm:AdditionalIcons}; Flags:unchecked

    [Files]
    来源:C:\ Program Files(x86)\Inno Setup 5 \Examples\MyProg.exe; DestDir:{app};标志:忽略版本
    来源:C:\ Users \\\\\\\\\\\\\\\\\\\\\\\ DestDir:{app};标志:ignoreversion
    ;注意:不要在任何共享系统文件上使用Flags:ignoreversion

    [图标]
    名称:{group} \ {#MyAppName};文件名:{app} \ {#MyAppExeName}
    名称:{commondesktop} \ {#MyAppName};文件名:{app} \ {#MyAppExeName};任务:desktopicon

    [运行]
    文件名:{app} \ {#MyAppExeName};描述:{cm:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}; Flags:nowait postinstall skipifsilent


    解决方案

    我所指的注册表键在 官方文档 。有一个注册表项直接包含 chrome.exe 文件的路径,所以它是恕我直言的最佳选择来获取Chrome应用程序。文件名。这是关键:

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

    其中< root> HKEY_LOCAL_MACHINE HKEY_CURRENT_USER 注册表根据Chrome是为当前用户安装还是为全局安装整个系统。



    在下面的脚本中,我使用上面的键不仅用于获取Chrome应用程序。文件名,但即使确定是否安装了Chrome浏览器:

      [Files] 
    来源:chrome_installer.exe; DestDir:{tmp};标志:deleteafterinstall

    [运行]
    文件名:{tmp} \chrome_installer.exe;检查:不是IsChromeInstalled
    文件名:{code:GetChromeFileName};参数:www.stackoverflow.com; \
    检查:IsChromeInstalled

    [Code]
    const
    ChromeAppRegKey ='Software\Microsoft\Windows\CurrentVersion\App Paths\chrome。可执行程序';

    函数IsChromeInstalled:Boolean;
    begin
    {检查HKCU下的Chrome应用程序注册条目,或}
    {HKLM根键,返回结果}
    结果:= RegKeyExists(HKEY_CURRENT_USER,ChromeAppRegKey)或
    RegKeyExists(HKEY_LOCAL_MACHINE,ChromeAppRegKey);
    end;

    函数GetChromeFileName(Value:string):string;
    var
    S:string;
    begin
    {将返回值初始化为空字符串}
    结果:='';
    {首先尝试从HKCU根密钥中读取Chrome应用程序文件名; }
    {如果失败,请尝试从HKLM中读取相同的内容;如果有任何成功,}
    {返回获得的注册表值}
    如果RegQueryStringValue(HKEY_CURRENT_USER,ChromeAppRegKey,'',S)或
    RegQueryStringValue(HKEY_LOCAL_MACHINE,ChromeAppRegKey,'',S)
    然后
    结果:= S;
    end;


    By following this: https://productforums.google.com/forum/#!topic/chrome/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)

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

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

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

    1. installing Google Chrome

    2. after install executing Google Chrome

    3. 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:\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. 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>\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.

    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 = '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;
    

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

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