Fixed inno setup to work with v6

Fixed inno setup to work with v6

#define APP_NAME "Myoddweb Classifier"
#define APP_PUBLISHER "myoddweb.com"
#define APP_URL "http://www.myoddweb.com"
#define APP_DIR "{pf}\myoddweb\classifier"
#define APP_SOURCE "..\bin\"
#define APP_REG_NAME "myoddweb.classifier"
#define EVENT_LOG_NAME "myoddweb.classifier"

; we add the engine version number, just in case.
#define APP_DESC "Classify mail items into various categories as they arrive (engine:" + GetFileVersion( AddBackslash( APP_SOURCE) + 'Classifier.Engine.dll' ) + ')'

; set the version number based on the classifier version number.
#define APP_VERSION GetFileVersion( AddBackslash( APP_SOURCE) + 'myoddweb.classifier.dll' )

;
; No need to edit past here.
;
[Setup]
AppName={#APP_NAME}
AppVersion={#APP_VERSION}
VersionInfoVersion={#APP_VERSION}
AppCopyright=myoddweb.classifier
AppId={{A061504F-FDFA-40E6-A283-AA044CB0DFC8}
DefaultDirName={#APP_DIR}
AppPublisher={#APP_PUBLISHER}
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_URL}
AppUpdatesURL={#APP_URL}
; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
; done in "64-bit mode" on x64, meaning it should use the native
; 64-bit Program Files directory and the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x86 x64
OutputBaseFilename="setup.{#APP_VERSION}"

[Files]
; x64
Source: "{#APP_SOURCE}\x64\Classifier.Engine.dll"; DestDir: "{app}\x64"; Flags: ignoreversion
Source: "{#APP_SOURCE}\x64\Classifier.Interop.dll"; DestDir: "{app}\x64"; Flags: ignoreversion

; x86
Source: "{#APP_SOURCE}\x86\Classifier.Engine.dll"; DestDir: "{app}\x86"; Flags: ignoreversion
Source: "{#APP_SOURCE}\x86\Classifier.Interop.dll"; DestDir: "{app}\x86"; Flags: ignoreversion

Source: "{#APP_SOURCE}Classifier.Interfaces.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}myoddweb.classifier.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}myoddweb.classifier.dll.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}myoddweb.classifier.vsto"; DestDir: "{app}"; Flags: ignoreversion

; Newtonsoft
Source: "{#APP_SOURCE}Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Newtonsoft.Json.xml"; DestDir: "{app}"; Flags: ignoreversion

; https://msdn.microsoft.com/en-us/library/ee712616.aspx
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Outlook.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.v4.0.Framework.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.VisualStudio.Tools.Applications.Runtime.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Common.v4.0.Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion

[Registry]

; create the event log registry...
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Services\EventLog\Application\{#EVENT_LOG_NAME}"; ValueType: string; ValueName: "EventMessageFile"; ValueData: ""

; @see https://msdn.microsoft.com/en-us/library/bb772100.aspx
; @see LoadBehavior=3 for vsto https://msdn.microsoft.com/en-us/library/bb386106.aspx

; x64
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; Flags: uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: dword; ValueName: "LoadBehavior"; ValueData: "3"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: string; ValueName: "Manifest"; ValueData: "file:///{app}\myoddweb.classifier.vsto|vstolocal"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: string; ValueName: "FriendlyName"; ValueData: "{#APP_NAME}"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: string; ValueName: "Description"; ValueData: "{#APP_DESC}"; Flags: uninsdeletevalue uninsdeletekeyifempty

; x86
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; Flags: uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: dword; ValueName: "LoadBehavior"; ValueData: "3"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: string; ValueName: "Manifest"; ValueData: "file:///{app}\myoddweb.classifier.vsto|vstolocal"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: string; ValueName: "FriendlyName"; ValueData: "{#APP_NAME}"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: string; ValueName: "Description"; ValueData: "{#APP_DESC}"; Flags: uninsdeletevalue uninsdeletekeyifempty

[Code]
// check if we have the vsto 64 bit installed
function IsOutlookVSTOInstalled64Bit() : boolean;
begin
  // if we are not x64 then we cannot check any x64 values.
  if not IsWin64 then
  begin
   Result := false;
   exit;
  end;

  if RegKeyExists( HKLM64, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4' ) then
  begin
    Result := true;
  end else
  if RegKeyExists( HKLM64, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4R' ) then
  begin
    Result := true;
  end else
    Result := false;
end;

// check if we have the vsto 32 bit installed
function IsOutlookVSTOInstalled32Bit() : boolean;
begin
  if RegKeyExists( HKLM32, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4' ) then
  begin
    Result := true;
  end else
  if RegKeyExists( HKLM32, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4R' ) then
  begin
    Result := true;
  end else
    Result := false;
end;

function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1'          .NET Framework 1.1
//    'v2.0'          .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//    'v4.5'          .NET Framework 4.5
//    'v4.5.1'        .NET Framework 4.5.1
//    'v4.5.2'        .NET Framework 4.5.2
//    'v4.6'          .NET Framework 4.6
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key, versionKey: string;
    install, release, serviceCount, versionRelease: cardinal;
    success: boolean;
begin
    versionKey := version;
    versionRelease := 0;

    // .NET 1.1 and 2.0 embed release number in version key
    if version = 'v1.1' then begin
        versionKey := 'v1.1.4322';
    end else if version = 'v2.0' then begin
        versionKey := 'v2.0.50727';
    end

    // .NET 4.5 and newer install as update to .NET 4.0 Full
    else if Pos('v4.', version) = 1 then begin
        versionKey := 'v4\Full';
        case version of
          'v4.5':   versionRelease := 378389;
          'v4.5.1': versionRelease := 378675; // or 378758 on Windows 8 and older
          'v4.5.2': versionRelease := 379893;
          'v4.6':   versionRelease := 393295; // or 393297 on Windows 8.1 and older
        end;
    end;

    // installation key group for all .NET versions
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;

    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;

    // .NET 4.0 and newer use value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;

    // .NET 4.5 and newer use additional value Release
    if versionRelease > 0 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
        success := success and (release >= versionRelease);
    end;

    result := success and (install = 1) and (serviceCount >= service);
end;

function InitializeUninstall() : Boolean;
var
   winHwnd: longint;
begin
   winHwnd := FindWindowByClassName( 'rctrl_renwnd32' );

   if(winHwnd <> 0 ) then
   begin
       MsgBox('Outlook is running. Close it before installing.', mbInformation, MB_OK);
       Result := false;
   end else
       Result := true

end;

function InitializeSetup(): Boolean;
var
   winHwnd: longint;
begin
   //
   if( not IsOutlookVSTOInstalled64Bit and not IsOutlookVSTOInstalled32Bit ) then
   begin
     MsgBox('Outlook VSTO 32/64 does appear to be installed, install cannot continue.', mbInformation, MB_OK);
     Result := false;
     exit;
   end;

   // check if outlook is running
   winHwnd := FindWindowByClassName( 'rctrl_renwnd32' );
   if(winHwnd <> 0 ) then
   begin
       MsgBox('Outlook is running. Please close it before installing.', mbInformation, MB_OK);
       Result := false;
   end
   else
   begin
     if not IsDotNetDetected('v4.5.2', 0) then begin
         MsgBox('MyOdd Classifier requires Microsoft .NET Framework 4.5.x'#13#13
                'Please use Windows Update to install this version,'#13
                'and then re-run the setup program.', mbInformation, MB_OK);
                result := false;
     end else
       result := true;
   end
end;

#define APP_NAME "Myoddweb Classifier"
#define APP_PUBLISHER "myoddweb.com"
#define APP_URL "http://www.myoddweb.com"
#define APP_DIR "{pf}\myoddweb\classifier"
#define APP_SOURCE "..\bin\"
#define APP_REG_NAME "myoddweb.classifier"
#define EVENT_LOG_NAME "myoddweb.classifier"

; we add the engine version number, just in case.
#define APP_DESC "Classify mail items into various categories as they arrive (engine:" + GetFileVersion( AddBackslash( APP_SOURCE) + 'Classifier.Engine.dll' ) + ')'

; set the version number based on the classifier version number.
#define APP_VERSION GetFileVersion( AddBackslash( APP_SOURCE) + 'myoddweb.classifier.dll' )

;
; No need to edit past here.
;
[Setup]
AppName={#APP_NAME}
AppVersion={#APP_VERSION}
VersionInfoVersion={#APP_VERSION}
AppCopyright=myoddweb.classifier
AppId={{A061504F-FDFA-40E6-A283-AA044CB0DFC8}
DefaultDirName={#APP_DIR}
AppPublisher={#APP_PUBLISHER}
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_URL}
AppUpdatesURL={#APP_URL}
; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
; done in "64-bit mode" on x64, meaning it should use the native
; 64-bit Program Files directory and the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x86 x64
OutputBaseFilename="setup.{#APP_VERSION}"

[Files]
; x64
Source: "{#APP_SOURCE}\x64\Classifier.Engine.dll"; DestDir: "{app}\x64"; Flags: ignoreversion
Source: "{#APP_SOURCE}\x64\Classifier.Interop.dll"; DestDir: "{app}\x64"; Flags: ignoreversion

; x86
Source: "{#APP_SOURCE}\x86\Classifier.Engine.dll"; DestDir: "{app}\x86"; Flags: ignoreversion
Source: "{#APP_SOURCE}\x86\Classifier.Interop.dll"; DestDir: "{app}\x86"; Flags: ignoreversion

Source: "{#APP_SOURCE}Classifier.Interfaces.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}myoddweb.classifier.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}myoddweb.classifier.dll.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}myoddweb.classifier.vsto"; DestDir: "{app}"; Flags: ignoreversion

; Newtonsoft
Source: "{#APP_SOURCE}Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Newtonsoft.Json.xml"; DestDir: "{app}"; Flags: ignoreversion

; https://msdn.microsoft.com/en-us/library/ee712616.aspx
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Outlook.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.v4.0.Framework.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.VisualStudio.Tools.Applications.Runtime.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Common.v4.0.Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#APP_SOURCE}Microsoft.Office.Tools.Outlook.v4.0.Utilities.dll"; DestDir: "{app}"; Flags: ignoreversion

[Registry]

; create the event log registry...
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Services\EventLog\Application\{#EVENT_LOG_NAME}"; ValueType: string; ValueName: "EventMessageFile"; ValueData: ""

; @see https://msdn.microsoft.com/en-us/library/bb772100.aspx
; @see LoadBehavior=3 for vsto https://msdn.microsoft.com/en-us/library/bb386106.aspx

; x64
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; Flags: uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: dword; ValueName: "LoadBehavior"; ValueData: "3"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: string; ValueName: "Manifest"; ValueData: "file:///{app}\myoddweb.classifier.vsto|vstolocal"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: string; ValueName: "FriendlyName"; ValueData: "{#APP_NAME}"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU64; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled64Bit; ValueType: string; ValueName: "Description"; ValueData: "{#APP_DESC}"; Flags: uninsdeletevalue uninsdeletekeyifempty

; x86
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; Flags: uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: dword; ValueName: "LoadBehavior"; ValueData: "3"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: string; ValueName: "Manifest"; ValueData: "file:///{app}\myoddweb.classifier.vsto|vstolocal"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: string; ValueName: "FriendlyName"; ValueData: "{#APP_NAME}"; Flags: uninsdeletevalue uninsdeletekeyifempty
Root: HKCU32; Subkey: "Software\Microsoft\Office\Outlook\Addins\{#APP_REG_NAME}"; Check: IsOutlookVSTOInstalled32Bit; ValueType: string; ValueName: "Description"; ValueData: "{#APP_DESC}"; Flags: uninsdeletevalue uninsdeletekeyifempty

[Code]
// check if we have the vsto 64 bit installed
function IsOutlookVSTOInstalled64Bit() : boolean;
begin
  // if we are not x64 then we cannot check any x64 values.
  if not IsWin64 then
  begin
   Result := false;
   exit;
  end

  if RegKeyExists( HKLM64, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4' ) then
  begin
    Result := true;
  end else
  if RegKeyExists( HKLM64, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4R' ) then
  begin
    Result := true;
  end else
    Result := false;
end;

// check if we have the vsto 32 bit installed
function IsOutlookVSTOInstalled32Bit() : boolean;
begin
  if RegKeyExists( HKLM32, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4' ) then
  begin
    Result := true;
  end else
  if RegKeyExists( HKLM32, 'SOFTWARE\Microsoft\VSTO Runtime Setup\v4R' ) then
  begin
    Result := true;
  end else
    Result := false;
end;

function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1'          .NET Framework 1.1
//    'v2.0'          .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//    'v4.5'          .NET Framework 4.5
//    'v4.5.1'        .NET Framework 4.5.1
//    'v4.5.2'        .NET Framework 4.5.2
//    'v4.6'          .NET Framework 4.6
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key, versionKey: string;
    install, release, serviceCount, versionRelease: cardinal;
    success: boolean;
begin
    versionKey := version;
    versionRelease := 0;

    // .NET 1.1 and 2.0 embed release number in version key
    if version = 'v1.1' then begin
        versionKey := 'v1.1.4322';
    end else if version = 'v2.0' then begin
        versionKey := 'v2.0.50727';
    end

    // .NET 4.5 and newer install as update to .NET 4.0 Full
    else if Pos('v4.', version) = 1 then begin
        versionKey := 'v4\Full';
        case version of
          'v4.5':   versionRelease := 378389;
          'v4.5.1': versionRelease := 378675; // or 378758 on Windows 8 and older
          'v4.5.2': versionRelease := 379893;
          'v4.6':   versionRelease := 393295; // or 393297 on Windows 8.1 and older
        end;
    end;

    // installation key group for all .NET versions
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;

    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;

    // .NET 4.0 and newer use value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;

    // .NET 4.5 and newer use additional value Release
    if versionRelease > 0 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
        success := success and (release >= versionRelease);
    end;

    result := success and (install = 1) and (serviceCount >= service);
end;

function InitializeUninstall() : Boolean;
var
   winHwnd: longint;
begin
   winHwnd := FindWindowByClassName( 'rctrl_renwnd32' );

   if(winHwnd <> 0 ) then
   begin
       MsgBox('Outlook is running. Close it before installing.', mbInformation, MB_OK);
       Result := false;
   end else
       Result := true

end;

function InitializeSetup(): Boolean;
var
   winHwnd: longint;
begin
   //
   if( not IsOutlookVSTOInstalled64Bit and not IsOutlookVSTOInstalled32Bit ) then
   begin
     MsgBox('Outlook VSTO 32/64 does appear to be installed, install cannot continue.', mbInformation, MB_OK);
     Result := false;
     exit;
   end

   // check if outlook is running
   winHwnd := FindWindowByClassName( 'rctrl_renwnd32' );
   if(winHwnd <> 0 ) then
   begin
       MsgBox('Outlook is running. Please close it before installing.', mbInformation, MB_OK);
       Result := false;
   end
   else
   begin
     if not IsDotNetDetected('v4.5.2', 0) then begin
         MsgBox('MyOdd Classifier requires Microsoft .NET Framework 4.5.x'#13#13
                'Please use Windows Update to install this version,'#13
                'and then re-run the setup program.', mbInformation, MB_OK);
                result := false;
     end else
       result := true;
   end
end;


Fixed issue in installer script related to french and russian localization

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

#define MyAppName "Guild Wars 2 Personal Assistant Overlay"
#define MyAppNameShort "GW2 Personal Assistant Overlay"
#define MyAppVersion "3.4"
#define MyAppPublisher "Samuel Hurne"
#define MyAppURL "http://samhurne.github.io/gw2pao/"
#define MyAppExeName "GW2PAO.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={{7CEEC405-42EA-4C71-9CAA-3812E0CEF49A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\GW2PAO
DefaultGroupName=GW2 Personal Assistant Overlay
AllowNoIcons=yes
OutputBaseFilename=GW2PAO_Setup_{#MyAppVersion}
SolidCompression=yes
UninstallDisplayName=Guild Wars 2 Personal Assistant Overlay
UninstallDisplayIcon={app}\GW2PAO.exe
LicenseFile=..\LICENSE.txt

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

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
; Common files:
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\AdjustedEventTimeTable.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\AnetCopyright.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Dungeons.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\NLog.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\StandardEventTimeTable.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\ThirdPartyLicenses.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\WvWObjectives.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\CopperNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\CypressNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\DailyCrafting.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\GoldNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\IronNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\OrichalcumNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\PlatinumNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\SilverNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\SilverwastesChests.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\DungeonNames.xml"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\EventNames.xml"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\GW2PAO.resources.dll"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\ItemDatabase.json"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\DungeonNames.xml"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\EventNames.xml"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\ItemDatabase.json"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\DungeonNames.xml"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\EventNames.xml"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\GW2PAO.resources.dll"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\ItemDatabase.json"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\DungeonNames.xml"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\EventNames.xml"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\GW2PAO.resources.dll"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\ItemDatabase.json"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\ru\GW2PAO.resources.dll"; DestDir: "{app}\Locale\ru"; Flags: ignoreversion
; No Browser files:
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\GW2PAO.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\GW2PAO.exe.config"; DestDir: "{app}"; Flags: ignoreversion
; Full Install files:
Source: "..\GW2PAO\bin\x86\Release\avcodec-53.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\avformat-53.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\avutil-51.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\Awesomium.Core.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\awesomium.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\Awesomium.Windows.Controls.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\awesomium_process"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\GW2PAO.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\GW2PAO.exe.config"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\icudt.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\inspector.pak"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\libGLESv2.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\pdf_js.pak"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\xinput9_1_0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser

[Icons]
Name: "{group}\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppNameShort}}"; Filename: "{#MyAppURL}"
Name: "{commondesktop}\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Components]
Name: "Browser"; Description: "Include Web Browser Feature"; Types: full

[Dirs]
Name: "{app}\UserData"; Flags: uninsneveruninstall; Permissions: users-full
Name: "{app}\Tasks"; Flags: uninsneveruninstall; Permissions: users-full
Name: "{app}\Logs"; Permissions: users-full
Name: "{app}\Locale"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Cache"; Flags: uninsalwaysuninstall; Components: Browser; Permissions: users-full
Name: "{app}\Locale\de"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\en"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\es"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\fr"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\ru"; Flags: uninsalwaysuninstall; Permissions: users-full

[Code]
var
  BrowserNoticePage: TOutputMsgWizardPage;

procedure InitializeWizard;
begin
  BrowserNoticePage := CreateOutputMsgPage(wpSelectComponents,
    'Web Browser Notice', '',
    'NOTE:'
    + #13#10 + #13#10 +
    'You have chosen to include the Web Browser feature. The embedded Web' +
    ' Browser feature does not include the same level of security that you would' +
    ' find in a full browser like Firefox or Google Chrome.'
    + #13#10 + #13#10 +
    'Do NOT use this feature for accessing sensitive data, and, like any' +
    ' other browser, always be careful of what sites you visit!');
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  // initialize result to not skip any page (not necessary, but safer)
  Result := False;
  // if the page that is asked to be skipped is your custom page, then...
  if PageID = BrowserNoticePage.ID then
    // if the component is not selected, skip the page
    Result := not IsComponentSelected('Browser');
end;

procedure DeleteUserSettingsDir(ADirName: string);
var
  FindRec: TFindRec;
begin
  if FindFirst(ADirName + '\*.*', FindRec) then begin
    try
      repeat
        if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then begin
          if (FindRec.Name <> '.') and (FindRec.Name <> '..') then begin
            DeleteUserSettingsDir(ADirName + '\' + FindRec.Name);
            RemoveDir(ADirName + '\' + FindRec.Name);
          end;
        end else if Pos('.xml', AnsiLowerCase(FindRec.Name)) > 0 then begin
          DeleteFile(ADirName + '\' + FindRec.Name);
        end else if Pos('.config', AnsiLowerCase(FindRec.Name)) > 0 then
          DeleteFile(ADirName + '\' + FindRec.Name);
      until not FindNext(FindRec);
    finally
      FindClose(FindRec);
    end;
  end;
  RemoveDir(ADirName);
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then begin
    if MsgBox('Delete user settings?', mbConfirmation, MB_YESNO) = IDYES
    then begin
      DeleteUserSettingsDir(ExpandConstant('{app}') + '\UserData');
      DeleteUserSettingsDir(ExpandConstant('{localappdata}') + '\GW2PAO');
    end;
  end;
end;

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

#define MyAppName "Guild Wars 2 Personal Assistant Overlay"
#define MyAppNameShort "GW2 Personal Assistant Overlay"
#define MyAppVersion "3.4"
#define MyAppPublisher "Samuel Hurne"
#define MyAppURL "http://samhurne.github.io/gw2pao/"
#define MyAppExeName "GW2PAO.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={{7CEEC405-42EA-4C71-9CAA-3812E0CEF49A}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\GW2PAO
DefaultGroupName=GW2 Personal Assistant Overlay
AllowNoIcons=yes
OutputBaseFilename=GW2PAO_Setup_{#MyAppVersion}
SolidCompression=yes
UninstallDisplayName=Guild Wars 2 Personal Assistant Overlay
UninstallDisplayIcon={app}\GW2PAO.exe
LicenseFile=..\LICENSE.txt

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

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
; Common files:
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\AdjustedEventTimeTable.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\AnetCopyright.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Dungeons.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\NLog.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\StandardEventTimeTable.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\ThirdPartyLicenses.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\WvWObjectives.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\CopperNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\CypressNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\DailyCrafting.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\GoldNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\IronNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\OrichalcumNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\PlatinumNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\SilverNodes.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Tasks\SilverwastesChests.xml"; DestDir: "{app}\Tasks"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\DungeonNames.xml"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\EventNames.xml"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\GW2PAO.resources.dll"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\ItemDatabase.json"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\de\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\de"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\DungeonNames.xml"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\EventNames.xml"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\ItemDatabase.json"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\en\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\en"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\DungeonNames.xml"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\EventNames.xml"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\GW2PAO.resources.dll"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\ItemDatabase.json"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\es\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\es"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\DungeonNames.xml"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\EventNames.xml"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\GW2PAO.resources.dll"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\ItemDatabase.json"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\fr\WvWObjectiveNames.xml"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\Locale\ru\GW2PAO.resources.dll"; DestDir: "{app}\Locale\fr"; Flags: ignoreversion
; No Browser files:
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\GW2PAO.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\GW2PAO\bin\x86\Release_WithoutBrowser\GW2PAO.exe.config"; DestDir: "{app}"; Flags: ignoreversion
; Full Install files:
Source: "..\GW2PAO\bin\x86\Release\avcodec-53.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\avformat-53.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\avutil-51.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\Awesomium.Core.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\awesomium.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\Awesomium.Windows.Controls.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\awesomium_process"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\GW2PAO.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\GW2PAO.exe.config"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\icudt.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\inspector.pak"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\libGLESv2.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\pdf_js.pak"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser
Source: "..\GW2PAO\bin\x86\Release\xinput9_1_0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Browser

[Icons]
Name: "{group}\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppNameShort}}"; Filename: "{#MyAppURL}"
Name: "{commondesktop}\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppNameShort}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Components]
Name: "Browser"; Description: "Include Web Browser Feature"; Types: full

[Dirs]
Name: "{app}\UserData"; Flags: uninsneveruninstall; Permissions: users-full
Name: "{app}\Tasks"; Flags: uninsneveruninstall; Permissions: users-full
Name: "{app}\Logs"; Permissions: users-full
Name: "{app}\Locale"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Cache"; Flags: uninsalwaysuninstall; Components: Browser; Permissions: users-full
Name: "{app}\Locale\de"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\en"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\es"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\fr"; Flags: uninsalwaysuninstall; Permissions: users-full
Name: "{app}\Locale\ru"; Flags: uninsalwaysuninstall; Permissions: users-full

[Code]
var
  BrowserNoticePage: TOutputMsgWizardPage;

procedure InitializeWizard;
begin
  BrowserNoticePage := CreateOutputMsgPage(wpSelectComponents,
    'Web Browser Notice', '',
    'NOTE:'
    + #13#10 + #13#10 +
    'You have chosen to include the Web Browser feature. The embedded Web' +
    ' Browser feature does not include the same level of security that you would' +
    ' find in a full browser like Firefox or Google Chrome.'
    + #13#10 + #13#10 +
    'Do NOT use this feature for accessing sensitive data, and, like any' +
    ' other browser, always be careful of what sites you visit!');
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  // initialize result to not skip any page (not necessary, but safer)
  Result := False;
  // if the page that is asked to be skipped is your custom page, then...
  if PageID = BrowserNoticePage.ID then
    // if the component is not selected, skip the page
    Result := not IsComponentSelected('Browser');
end;

procedure DeleteUserSettingsDir(ADirName: string);
var
  FindRec: TFindRec;
begin
  if FindFirst(ADirName + '\*.*', FindRec) then begin
    try
      repeat
        if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then begin
          if (FindRec.Name <> '.') and (FindRec.Name <> '..') then begin
            DeleteUserSettingsDir(ADirName + '\' + FindRec.Name);
            RemoveDir(ADirName + '\' + FindRec.Name);
          end;
        end else if Pos('.xml', AnsiLowerCase(FindRec.Name)) > 0 then begin
          DeleteFile(ADirName + '\' + FindRec.Name);
        end else if Pos('.config', AnsiLowerCase(FindRec.Name)) > 0 then
          DeleteFile(ADirName + '\' + FindRec.Name);
      until not FindNext(FindRec);
    finally
      FindClose(FindRec);
    end;
  end;
  RemoveDir(ADirName);
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then begin
    if MsgBox('Delete user settings?', mbConfirmation, MB_YESNO) = IDYES
    then begin
      DeleteUserSettingsDir(ExpandConstant('{app}') + '\UserData');
      DeleteUserSettingsDir(ExpandConstant('{localappdata}') + '\GW2PAO');
    end;
  end;
end;


Copy "*.bat" files to the system's Windows directory.

git-svn-id: 4c7b768bc2e2a56aa1c56b1b5a9454ba68342430@2877 ac9c905b-388a-4ddf-9b6a-4063a022bc57

; Script generated by the Inno Setup Script Wizard.

#define MyAppName "Logtalk"
#define MyAppVerName "Logtalk 2.28.0"
#define MyAppPublisher "Logtalk.org"
#define MyAppURL "http://logtalk.org"
#define MyAppUrlName "Logtalk Web Site.url"
#define MyAppRegURL "http://logtalk.org/regform.html"
#define MyAppRegUrlName "Logtalk Registration.url"

#define LOGTALKHOME "{reg:HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment,LOGTALKHOME|{pf}\Logtalk}"
#define LOGTALKUSER "{reg:HKCU\Environment,LOGTALKUSER|{userdocs}\Logtalk}"

[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesEnvironment=yes
DefaultDirName={#LOGTALKHOME}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=C:\logtalk\LICENSE.txt
InfoBeforeFile=C:\logtalk\README.txt
OutputBaseFilename=lgt2280
Compression=lzma
SolidCompression=yes

VersionInfoVersion=2.28.0
VersionInfoCopyright= Paulo Moura, 1998-2006

AllowRootDirectory=yes
UninstallFilesDir="{userdocs}\Logtalk uninstaller"

MinVersion=0,5.0

[Types]
Name: "full"; Description: "Full installation (recommended)"
Name: "base"; Description: "Base system installation"
Name: "user"; Description: "User data files installation (must be run by all end-users)"
Name: "prolog"; Description: "Prolog integration (see documentation for compatibility details)"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "base"; Description: "Base system"; Types: full base custom; Flags: disablenouninstallwarning
Name: "user"; Description: "User data files"; Types: full user custom; Flags: checkablealone
Name: "user\backup"; Description: "Backup current user data files"; Types: full user custom
Name: "prolog"; Description: "Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\ciao"; Description: "Ciao Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\eclipse"; Description: "ECLiPSe integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\gprolog"; Description: "GNU Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\plc"; Description: "K-Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\sicstus"; Description: "SICStus Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swi"; Description: "SWI-Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsb"; Description: "XSB integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\yap"; Description: "YAP integration"; Types: full prolog custom; Flags: disablenouninstallwarning

[Tasks]
Name: registration; Description: "&Register {#MyAppName} (opens a web page; requires Internet connection)"; Components: base user
Name: shortcut; Description: "&Create a desktop shortcut to the Logtalk user folder"; Components: user

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

[Messages]
BeveledLabel=Logtalk 2.28.0  Paulo Moura, 1998-2006

[Dirs]
Name: {code:GetLgtUserDir}; Components: user; Flags: uninsneveruninstall
Name: "{userdocs}\Logtalk uninstaller"

[Files]
Source: "C:\logtalk\*"; Excludes: ".*,CVS"; DestDir: "{app}"; Components: base; Flags: ignoreversion recursesubdirs createallsubdirs

Source: "C:\logtalk\configs\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\configs"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\contributions\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\contributions"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\examples\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\examples"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\libpaths\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\libpaths"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\library\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\library"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\xml\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\xml"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall

Source: "C:\logtalk\scripts\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion
Source: "C:\logtalk\xml\*.bat"; DestDir: "{win}"; Components: base; Flags: ignoreversion

[INI]
Filename: "{app}\{#MyAppUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppURL}"; Components: base
Filename: "{app}\{#MyAppRegUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppRegURL}"; Components: base

[Icons]
Name: "{group}\{#MyAppName} Bibliography"; Filename: "{app}\BIBLIOGRAPHY.txt"; Components: base
Name: "{group}\{#MyAppName} Documentation"; Filename: "{app}\manuals\index.html"; Components: base
Name: "{group}\{#MyAppName} License"; Filename: "{app}\LICENSE.txt"; Components: base
Name: "{group}\{#MyAppName} Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: base
Name: "{group}\{#MyAppName} Read Me"; Filename: "{app}\README.txt"; Components: base

Name: "{group}\{#MyAppName} Web Site"; Filename: "{app}\{#MyAppUrlName}"; Components: base
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Components: base

Name: "{code:GetLgtUserDir}\manuals"; Filename: "{app}\manuals"; Components: user
Name: "{code:GetLgtUserDir}\wenv"; Filename: "{app}\wenv"; Components: user

Name: "{userdesktop}\Logtalk user files"; Filename: "{code:GetLgtUserDir}"; Components: user; Tasks: shortcut

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue

[Run]
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_ciaolgt.js"""; Description: "Ciao Prolog integration"; Components: prolog\ciao
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_eclipselgt.js"""; Description: "ECLiPSe integration"; Components: prolog\eclipse
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_gplgt.js"""; Description: "GNU Prolog integration"; Components: prolog\gprolog
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_plclgt.js"""; Description: "K-Prolog integration"; Components: prolog\plc
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_sicstuslgt.js"""; Description: "SICStus Prolog integration"; Components: prolog\sicstus
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_swilgt.js"""; Description: "SWI-Prolog integration"; Components: prolog\swi
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_xsblgt.js"""; Description: "XSB integration"; Components: prolog\xsb
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_yaplgt.js"""; Description: "YAP integration"; Components: prolog\yap

Filename: "{app}\RELEASE_NOTES.txt"; Description: "View the release notes"; Components: base user; Flags: postinstall shellexec skipifsilent
Filename: "{app}\CUSTOMIZE.txt"; Description: "Read the customization instructions for completing your setup"; Components: base user; Flags: postinstall shellexec skipifsilent

Filename: "{app}\{#MyAppRegUrlName}"; Flags: shellexec nowait; Tasks: registration

[UninstallDelete]
Type: filesandordirs; Name: "{app}"; Components: base
Type: filesandordirs; Name: "{group}"; Components: base

[Code]
var
  LgtUserDirPage: TInputDirWizardPage;
  WarningPage: TOutputMsgWizardPage;
  Explanation, Warning, Scripts: String;

procedure InitializeWizard;
begin
  Explanation := 'Select the folder in which Setup should install Logtalk user data files, then click Next.'
                 + Chr(13) + Chr(13)
                 + 'These files allows each user to independently customize Logtalk and to freely modify the provided programming examples.'
                 + Chr(13) + Chr(13)
                 + 'A copy of these files must exist in the user home folder in order to use the Logtalk-Prolog integration scripts available from the Start Menu.'
                 + Chr(13) + Chr(13)
                 + 'Addtional end-users may use this installer to make a copy of these files on their home folders after a full installation of Logtalk.';
  LgtUserDirPage := CreateInputDirPage(wpSelectDir,
    'Select folder for Logtalk user data files', 'Where should Logtalk user data files be installed?',
    Explanation,
    False, 'New Folder');
  LgtUserDirPage.Add('');
  LgtUserDirPage.Values[0] := ExpandConstant('{#LOGTALKUSER}');
  if not IsAdminLoggedOn then
  begin
    Warning := 'Full installation of Logtalk requires an administrative user.'
               + Chr(13) + Chr(13)
               + 'If the base Logtalk system is already installed, you may proceed in order to setup Logtalk for you as an end-user.'
               + Chr(13) + Chr(13)
               + 'If Logtalk is already set for you, this installer will make a backup copy of your current files (if you choose the same installation folder) and will restore all user data files to their default, pristine state.';
    WarningPage := CreateOutputMsgPage(wpWelcome,
  'Information', 'Please read the following important information before continuing.', Warning);
  end
end;

function GetLgtUserDir(Param: String): String;
begin
  Result := LgtUserDirPage.Values[0]
end;

function GetCurrentDate(Param: String): String;
begin
  Result := GetDateTimeString('dddddd tt', '-', '-')
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if (PageID = wpSelectDir) and not IsAdminLoggedOn then
    Result := True
  else if (PageID = wpSelectComponents) and not IsAdminLoggedOn then
  begin
    WizardForm.TypesCombo.ItemIndex := 2;
    WizardForm.TypesCombo.OnChange(nil);
    Result := True
  end
  else if (PageID = wpReady) and not IsAdminLoggedOn then
    Result := True
  else
    Result := False;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if (CurStep = ssInstall) and DirExists(LgtUserDirPage.Values[0]) and (pos('backup', WizardSelectedComponents(False)) > 0) then
    RenameFile(LgtUserDirPage.Values[0], LgtUserDirPage.Values[0] + ' backup ' + GetDateTimeString('dddddd tt', '-', '-'));
  if (CurStep = ssInstall) and (pos('prolog', WizardSelectedComponents(False)) > 0) then
  begin
    Scripts := 'The installer needs to run a set of JScripts scripts within command shells' + Chr(13) +
               'in order to integrate Logtalk with your installed Prolog compilers.' + Chr(13) + Chr(13) +
               'Make sure that any security software you may have installed do not block' + Chr(13) +
               'the execution of the scripts.';
    MsgBox(Scripts, mbInformation, MB_OK)
  end
end;

; Script generated by the Inno Setup Script Wizard.

#define MyAppName "Logtalk"
#define MyAppVerName "Logtalk 2.28.0"
#define MyAppPublisher "Logtalk.org"
#define MyAppURL "http://logtalk.org"
#define MyAppUrlName "Logtalk Web Site.url"
#define MyAppRegURL "http://logtalk.org/regform.html"
#define MyAppRegUrlName "Logtalk Registration.url"

#define LOGTALKHOME "{reg:HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment,LOGTALKHOME|{pf}\Logtalk}"
#define LOGTALKUSER "{reg:HKCU\Environment,LOGTALKUSER|{userdocs}\Logtalk}"

[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ChangesEnvironment=yes
DefaultDirName={#LOGTALKHOME}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=C:\logtalk\LICENSE.txt
InfoBeforeFile=C:\logtalk\README.txt
OutputBaseFilename=lgt2280
Compression=lzma
SolidCompression=yes

VersionInfoVersion=2.28.0
VersionInfoCopyright= Paulo Moura, 1998-2006

AllowRootDirectory=yes
UninstallFilesDir="{userdocs}\Logtalk uninstaller"

MinVersion=0,5.0

[Types]
Name: "full"; Description: "Full installation (recommended)"
Name: "base"; Description: "Base system installation"
Name: "user"; Description: "User data files installation (must be run by all end-users)"
Name: "prolog"; Description: "Prolog integration (see documentation for compatibility details)"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "base"; Description: "Base system"; Types: full base custom; Flags: disablenouninstallwarning
Name: "user"; Description: "User data files"; Types: full user custom; Flags: checkablealone
Name: "user\backup"; Description: "Backup current user data files"; Types: full user custom
Name: "prolog"; Description: "Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\ciao"; Description: "Ciao Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\eclipse"; Description: "ECLiPSe integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\gprolog"; Description: "GNU Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\plc"; Description: "K-Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\sicstus"; Description: "SICStus Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\swi"; Description: "SWI-Prolog integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\xsb"; Description: "XSB integration"; Types: full prolog custom; Flags: disablenouninstallwarning
Name: "prolog\yap"; Description: "YAP integration"; Types: full prolog custom; Flags: disablenouninstallwarning

[Tasks]
Name: registration; Description: "&Register {#MyAppName} (opens a web page; requires Internet connection)"; Components: base user
Name: shortcut; Description: "&Create a desktop shortcut to the Logtalk user folder"; Components: user

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

[Messages]
BeveledLabel=Logtalk 2.28.0  Paulo Moura, 1998-2006

[Dirs]
Name: {code:GetLgtUserDir}; Components: user; Flags: uninsneveruninstall
Name: "{userdocs}\Logtalk uninstaller"

[Files]
Source: "C:\logtalk\*"; Excludes: ".*,CVS"; DestDir: "{app}"; Components: base; Flags: ignoreversion recursesubdirs createallsubdirs

Source: "C:\logtalk\configs\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\configs"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\contributions\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\contributions"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\examples\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\examples"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\libpaths\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\libpaths"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\library\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\library"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "C:\logtalk\xml\*"; Excludes: ".*,CVS"; DestDir: "{code:GetLgtUserDir}\xml"; Components: user; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall

[INI]
Filename: "{app}\{#MyAppUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppURL}"; Components: base
Filename: "{app}\{#MyAppRegUrlName}"; Section: "InternetShortcut"; Key: "URL"; String: "{#MyAppRegURL}"; Components: base

[Icons]
Name: "{group}\{#MyAppName} Bibliography"; Filename: "{app}\BIBLIOGRAPHY.txt"; Components: base
Name: "{group}\{#MyAppName} Documentation"; Filename: "{app}\manuals\index.html"; Components: base
Name: "{group}\{#MyAppName} License"; Filename: "{app}\LICENSE.txt"; Components: base
Name: "{group}\{#MyAppName} Release Notes"; Filename: "{app}\RELEASE_NOTES.txt"; Components: base
Name: "{group}\{#MyAppName} Read Me"; Filename: "{app}\README.txt"; Components: base

Name: "{group}\{#MyAppName} Web Site"; Filename: "{app}\{#MyAppUrlName}"; Components: base
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Components: base

Name: "{code:GetLgtUserDir}\manuals"; Filename: "{app}\manuals"; Components: user
Name: "{code:GetLgtUserDir}\wenv"; Filename: "{app}\wenv"; Components: user

Name: "{userdesktop}\Logtalk user files"; Filename: "{code:GetLgtUserDir}"; Components: user; Tasks: shortcut

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "LOGTALKHOME"; ValueData: "{app}"; Components: base; Flags: deletevalue uninsdeletevalue
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "LOGTALKUSER"; ValueData: "{code:GetLgtUserDir}"; Flags: deletevalue uninsdeletevalue

[Run]
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_ciaolgt.js"""; Description: "Ciao Prolog integration"; Components: prolog\ciao
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_eclipselgt.js"""; Description: "ECLiPSe integration"; Components: prolog\eclipse
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_gplgt.js"""; Description: "GNU Prolog integration"; Components: prolog\gprolog
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_plclgt.js"""; Description: "K-Prolog integration"; Components: prolog\plc
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_sicstuslgt.js"""; Description: "SICStus Prolog integration"; Components: prolog\sicstus
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_swilgt.js"""; Description: "SWI-Prolog integration"; Components: prolog\swi
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_xsblgt.js"""; Description: "XSB integration"; Components: prolog\xsb
Filename: "{cmd}"; Parameters: "/C cscript ""{app}\scripts\make_yaplgt.js"""; Description: "YAP integration"; Components: prolog\yap

Filename: "{app}\RELEASE_NOTES.txt"; Description: "View the release notes"; Components: base user; Flags: postinstall shellexec skipifsilent
Filename: "{app}\CUSTOMIZE.txt"; Description: "Read the customization instructions for completing your setup"; Components: base user; Flags: postinstall shellexec skipifsilent

Filename: "{app}\{#MyAppRegUrlName}"; Flags: shellexec nowait; Tasks: registration

[UninstallDelete]
Type: filesandordirs; Name: "{app}"; Components: base
Type: filesandordirs; Name: "{group}"; Components: base

[Code]
var
  LgtUserDirPage: TInputDirWizardPage;
  WarningPage: TOutputMsgWizardPage;
  Explanation, Warning, Scripts: String;

procedure InitializeWizard;
begin
  Explanation := 'Select the folder in which Setup should install Logtalk user data files, then click Next.'
                 + Chr(13) + Chr(13)
                 + 'These files allows each user to independently customize Logtalk and to freely modify the provided programming examples.'
                 + Chr(13) + Chr(13)
                 + 'A copy of these files must exist in the user home folder in order to use the Logtalk-Prolog integration scripts available from the Start Menu.'
                 + Chr(13) + Chr(13)
                 + 'Addtional end-users may use this installer to make a copy of these files on their home folders after a full installation of Logtalk.';
  LgtUserDirPage := CreateInputDirPage(wpSelectDir,
    'Select folder for Logtalk user data files', 'Where should Logtalk user data files be installed?',
    Explanation,
    False, 'New Folder');
  LgtUserDirPage.Add('');
  LgtUserDirPage.Values[0] := ExpandConstant('{#LOGTALKUSER}');
  if not IsAdminLoggedOn then
  begin
    Warning := 'Full installation of Logtalk requires an administrative user.'
               + Chr(13) + Chr(13)
               + 'If the base Logtalk system is already installed, you may proceed in order to setup Logtalk for you as an end-user.'
               + Chr(13) + Chr(13)
               + 'If Logtalk is already set for you, this installer will make a backup copy of your current files (if you choose the same installation folder) and will restore all user data files to their default, pristine state.';
    WarningPage := CreateOutputMsgPage(wpWelcome,
  'Information', 'Please read the following important information before continuing.', Warning);
  end
end;

function GetLgtUserDir(Param: String): String;
begin
  Result := LgtUserDirPage.Values[0]
end;

function GetCurrentDate(Param: String): String;
begin
  Result := GetDateTimeString('dddddd tt', '-', '-')
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if (PageID = wpSelectDir) and not IsAdminLoggedOn then
    Result := True
  else if (PageID = wpSelectComponents) and not IsAdminLoggedOn then
  begin
    WizardForm.TypesCombo.ItemIndex := 2;
    WizardForm.TypesCombo.OnChange(nil);
    Result := True
  end
  else if (PageID = wpReady) and not IsAdminLoggedOn then
    Result := True
  else
    Result := False;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if (CurStep = ssInstall) and DirExists(LgtUserDirPage.Values[0]) and (pos('backup', WizardSelectedComponents(False)) > 0) then
    RenameFile(LgtUserDirPage.Values[0], LgtUserDirPage.Values[0] + ' backup ' + GetDateTimeString('dddddd tt', '-', '-'));
  if (CurStep = ssInstall) and (pos('prolog', WizardSelectedComponents(False)) > 0) then
  begin
    Scripts := 'The installer needs to run a set of JScripts scripts within command shells' + Chr(13) +
               'in order to integrate Logtalk with your installed Prolog compilers.' + Chr(13) + Chr(13) +
               'Make sure that any security software you may have installed do not block' + Chr(13) +
               'the execution of the scripts.';
    MsgBox(Scripts, mbInformation, MB_OK)
  end
end;