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

#define MyAppName "ADI iSensor IMU Demo 1.0.0"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "Analog Devices Inc."
#define MyAppURL "http://www.analog.com/"
#define MyAppExeName "MyProg.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={{BA48CA27-42D4-4E21-8AEC-061E64093207}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
LicenseFile=C:\Users\juanj\Documents\GitHub\ADIS-IMU-Demo\resources\LICENSE.txt
InfoBeforeFile=C:\Users\juanj\Documents\GitHub\ADIS-IMU-Demo\resources\beforeinstall.txt
InfoAfterFile=C:\Users\juanj\Documents\GitHub\ADIS-IMU-Demo\resources\afterinstall.txt
OutputDir=C:\Users\juanj\Desktop
OutputBaseFilename=ADI_iSensor_Demo_Installer_1.0.0
SetupIconFile=C:\Users\Public\Documents\IDE\resources\Analog_New.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "C:\Users\Public\Documents\IDE\*"; DestDir: "C:\Users\Public\Documents\IDE\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Public\Documents\ADIS-IMU-Demo\*"; DestDir: "C:\Users\Public\Documents\ADIS-IMU-Demo\"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Tasks]
Name: "install_jre"; Description: "Install Java JRE"; GroupDescription: "Runtime:";
Name: "install_usb"; Description: "Install USB Driver"; GroupDescription: "Runtime:";

[Run]
Filename: "C:\Users\Public\Documents\IDE\resources\jre-8u192-windows-i586.exe"; StatusMsg: "Installing Java JRE (x32)"; Check: Not IsWin64(); Tasks: install_jre; Flags: skipifsilent
Filename: "C:\Users\Public\Documents\IDE\resources\jre-8u192-windows-x64.exe"; StatusMsg: "Installing Java JRE (x64)"; Check: IsWin64(); Tasks: install_jre; Flags: skipifsilent

Filename: "C:\Users\Public\Documents\IDE\resources\serial_install.exe"; StatusMsg: "Installing USB Driver"; Tasks: install_usb; Flags: skipifsilent
<commit_msg>Updated installer script<commit_after>; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "ADI iSensor IMU Demo"
#define MyAppVersion "1.0.1"
#define MyAppPublisher "<NAME> - Analog Devices, Inc."
#define MyAppURL "https://www.analog.com/"
#define MyAppExeName "ADI_iSensor_IMU_Demo_Installer_1.0.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={{BA48CA27-42D4-4E21-8AEC-061E64093207}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
LicenseFile=C:\Users\juanj\Documents\GitHub\ADI\ADIS-IMU-Demo\resources\LICENSE.txt
InfoBeforeFile=C:\Users\juanj\Documents\GitHub\ADI\ADIS-IMU-Demo\resources\beforeinstall.txt
InfoAfterFile=C:\Users\juanj\Documents\GitHub\ADI\ADIS-IMU-Demo\resources\afterinstall.txt
OutputDir=C:\Users\juanj\Desktop
OutputBaseFilename=ADI_iSensor_Demo_Installer_1.0.1
SetupIconFile=C:\Users\Public\Documents\IDE\resources\Analog_New.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "C:\Users\Public\Documents\IDE\*"; DestDir: "C:\Users\Public\Documents\IDE\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Public\Documents\ADIS-IMU-Demo\*"; DestDir: "C:\Users\Public\Documents\ADIS-IMU-Demo\"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Tasks]
Name: "install_jre"; Description: "Install Java JRE"; GroupDescription: "Runtime:";
Name: "install_usb"; Description: "Install USB Driver"; GroupDescription: "Runtime:";

[Run]
Filename: "C:\Users\Public\Documents\IDE\resources\jre-8u192-windows-i586.exe"; StatusMsg: "Installing Java JRE (x32)"; Check: Not IsWin64(); Tasks: install_jre; Flags: skipifsilent
Filename: "C:\Users\Public\Documents\IDE\resources\jre-8u192-windows-x64.exe"; StatusMsg: "Installing Java JRE (x64)"; Check: IsWin64(); Tasks: install_jre; Flags: skipifsilent
Filename: "C:\Users\Public\Documents\IDE\resources\serial_install.exe"; StatusMsg: "Installing USB Driver"; Tasks: install_usb; Flags: skipifsilent

[Code]
function IsAppRunning(const FileName: string): Boolean;
var
  FWMIService: Variant;
  FSWbemLocator: Variant;
  FWbemObjectSet: Variant;
begin
  Result := false;
  FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
  FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
  FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
  Result := (FWbemObjectSet.Count > 0);
  FWbemObjectSet := Unassigned;
  FWMIService := Unassigned;
  FSWbemLocator := Unassigned;
end;

function GetUninstallString: string;
var
  sUnInstPath: string;
  sUnInstallString: String;
begin
  Result := '';
  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{{BA48CA27-42D4-4E21-8AEC-061E64093207}_is1'); { Your App GUID/ID }
  sUnInstallString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
  Result := sUnInstallString;
end;

function IsUpgrade: Boolean;
begin
  Result := (GetUninstallString() <> '');
end;

function InitializeSetup: boolean;
var
  V: Integer;
  iResultCode: Integer;
  sUnInstallString: string;
begin
  Result := not IsAppRunning('java.exe');
  if not Result then
  MsgBox('Java is running. Please close the application before running the installer. ', mbError, MB_OK);
  Result := True; { in case when no previous version is found }
  if RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{BA48CA27-42D4-4E21-8AEC-061E64093207}_is1', 'UninstallString') then  { Your App GUID/ID }
  begin
    V := MsgBox(ExpandConstant('An old version of the demo application was detected. Do you want to uninstall it?'), mbInformation, MB_YESNO); { Custom Message if App installed }
    if V = IDYES then
    begin
      sUnInstallString := GetUninstallString();
      sUnInstallString :=  RemoveQuotes(sUnInstallString);
      Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);
      Result := True; { if you want to proceed after uninstall }

      { Exit; //if you want to quit after uninstall }
    end
    else
      Result := False; { when older version present and not uninstalled }
  end;
end;
{'fraction_non_alphanumeric': 0.124149423691154, 'fraction_numerical': 0.021385918622413555, 'mean_word_length': 6.137760158572845, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7533152', 'n_tokens_mistral': 2618, 'n_tokens_neox': 2431, 'n_words': 552}