Inno Setup - How can I report installation when running Google Chrome, should it open stackoverflow.com?

Following this: https://productforums.google.com/forum/#!topic/chrome/8XnSOnhLBzA

  • Went to http://ninite.com/chrome/ to get their Chrome installer (but that doesn’t help me get me to open a specific website after installing Google Chrome)

  • Now I'm trying to use the Inno Setup program myself to make sure that I have almost the same as Ninite

  • After installing Inno Setup with installing Google Chrome, how can I open www.stackoverflow.com with Google Chrome?

Here is my Inno Setup code that does not execute correctly in step 3:

  • install google chrome

  • after installing Google Chrome

  • BUT, how can I say Google Chrome - follow this 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
+6
source share
1 answer

The following might work because the registry key that I am referencing is described in official docsfor the Chrome installer. There is one registry key that directly contains the file path chrome.exe, so in my opinion this is the best choice for getting a Chrome application. file name. Here is the key:

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

Where <root>is the root directory HKEY_LOCAL_MACHINEor HKEY_CURRENT_USERdepending on whether Chrome is installed for the current user or globally for the entire system.

Chrome. , , 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 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;
+10

Source: https://habr.com/ru/post/1532228/


All Articles