Added dark_mode, locale default constant

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

#define MyAppName "WeblocOpener"
#define MyAppPublisher "Eugene Zrazhevsky"
#define MyAppURL "https://benchdoos.github.io/"
#define MyAppExeName "WeblocOpener.exe"
#define MyAppIconsFile "icons.icl"
#define MyAppSourcePath "F:\Developer\JAVA\WeblocOpener"
#define MyAppAdditionalPath "F:\Developer\JAVA\WeblocOpener\build\installer"
#define ImagesPath "F:\Developer\JAVA\WeblocOpener\build\installer\images"
#define ApplicationVersion GetFileVersion('F:\Developer\JAVA\WeblocOpener\build\WeblocOpener.exe')
#define ApplicationCopyright GetFileCopyright('F:\Developer\JAVA\WeblocOpener\build\WeblocOpener.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={{F1300E10-BBB2-4695-AC2F-3D58DC0BC0A6}
AppName={#MyAppName}
AppVersion={#ApplicationVersion}
VersionInfoVersion=1.0
AppCopyright={#ApplicationCopyright}

AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir={#MyAppAdditionalPath}\setup
OutputBaseFilename=WeblocOpenerSetup
LicenseFile={#MyAppAdditionalPath}\languages\license\License.rtf

SetupIconFile={#ImagesPath}\icon.ico
WizardImageFile={#ImagesPath}\WizardImageFile.bmp
WizardSmallImageFile={#ImagesPath}\WizardSmallImageFile.bmp
UninstallDisplayIcon={app}\{#MyAppIconsFile},2

ArchitecturesInstallIn64BitMode=x64

Compression=lzma
SolidCompression=yes
ChangesAssociations=yes
PrivilegesRequired=admin

ShowLanguageDialog=auto
DisableProgramGroupPage=yes

[Registry]
; File association
Root: HKCR; Subkey: ".webloc"; ValueType: string; ValueName: ""; ValueData: "Webloc"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc"; ValueType: string; ValueName: ""; ValueData: {cm:WeblocLink}; Flags: uninsdeletekey
Root: HKCR; Subkey: "Webloc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppIconsFile},3"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue

; Add new file .webloc
Root: HKCR; Subkey: ".webloc\ShellNew"; ValueType: string; ValueName: "ItemName"; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".webloc\ShellNew"; ValueType: string; ValueName: "FileName"; ValueData: "{app}\Template.webloc"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".webloc\ShellNew"; ValueType: string; ValueName: "NullFile"; ValueData: ""; Flags: uninsdeletevalue

; Add edit file menu
Root: HKCR; Subkey: "Webloc\shell\edit"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",7"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\edit\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-edit"" ""%1"" "; Flags: uninsdeletevalue

; Add qr file menu
Root: HKCR; Subkey: "Webloc\shell\GenerateQRCode"; ValueType: string; ValueName: ""; ValueData: {cm:GenerateQrCode}; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\GenerateQRCode"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",5"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\GenerateQRCode\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-qr"" ""%1"" "; Flags: uninsdeletevalue

; Add copy qr file menu
Root: HKCR; Subkey: "Webloc\shell\CopyQRCode"; ValueType: string; ValueName: ""; ValueData: {cm:CopyQRMenu}; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\CopyQRCode"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",5"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\CopyQRCode\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-copy-qr"" ""%1"" "; Flags: uninsdeletevalue

; Add copy file menu
Root: HKCR; Subkey: "Webloc\shell\Copy"; ValueType: string; ValueName: ""; ValueData: {cm:CopyMenu}; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\Copy"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",6"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\Copy\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-copy"" ""%1"" "; Flags: uninsdeletevalue

; Add updater autorun
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Update"; ValueData: """start weblocopener -update-silent"""; Flags: uninsdeletevalue

; Add app settings
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: ""; ValueData: ""; Flags: uninsdeletevalue
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "auto_update_enabled"; ValueData: "true"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "browser"; ValueData: "default"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "open_folder_for_qr"; ValueData: "true"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "notifications"; ValueData: "true"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "dark_mode"; ValueData: "21:0;7:0"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "locale"; ValueData: "default"; Flags: uninsdeletevalue createvalueifdoesntexist

Root: HKCU; Subkey: "SOFTWARE\{#MyAppName}\Capabilities"; ValueType: string; ValueName: "ApplicationDescription"; ValueData: "Open, edit and create .webloc links on Windows"; Flags: uninsdeletevalue
Root: HKCU; Subkey: "SOFTWARE\{#MyAppName}\Capabilities\FileAssociations"; ValueType: string; ValueName: ".webloc"; ValueData: {cm:WeblocLink}; Flags: uninsdeletevalue

; Adds start command to cmd
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\{#MyAppName}.exe"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\{#MyAppName}.exe"; ValueType: string; ValueName: "Path"; ValueData: "{app}\"; Flags: uninsdeletevalue

[Registry]
;delete old entries
;Root: HKCU; Subkey: "<path>"; ValueName: "<Value>"; ValueType: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "current_version"; ValueData: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "install_location"; ValueData: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "name"; ValueData: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "url_update_info"; ValueData: none; Flags: deletevalue;

[Languages]
Name: "English"; MessagesFile: "{#MyAppAdditionalPath}\languages\English.isl";
Name: "German"; MessagesFile: "{#MyAppAdditionalPath}\languages\German.isl"
Name: "French"; MessagesFile: "{#MyAppAdditionalPath}\languages\French.isl"
Name: "Italian"; MessagesFile: "{#MyAppAdditionalPath}\languages\Italian.isl"
Name: "Russian"; MessagesFile: "{#MyAppAdditionalPath}\languages\Russian.isl"

[Files]
Source: "{#MyAppSourcePath}\build\WeblocOpener.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppAdditionalPath}\Template.webloc"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ImagesPath}\icons.icl"; DestDir: "{app}"; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[InstallDelete]
;Deletes old files
Type: files; Name: "{group}\{#MyAppName} {cm:Update}.lnk";
Type: files; Name: "{commonprograms}\{#MyAppName} {cm:Update}.lnk"
Type: files; Name: "{app}\Updater.jar"
Type: files; Name: "{app}\readme.rtf"

Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\{#MyAppName}\DEBUG"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\{#MyAppName}\INFO"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\{#MyAppName}\WARN"

Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\Updater\DEBUG"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\Updater\INFO"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\Updater\WARN"

Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Updater_.jar"

[Icons]
Name: "{group}\{#MyAppName} {cm:Settings}"; Filename: "{app}\{#MyAppExeName}"; OnlyBelowVersion: 6.1.9;
Name: "{commonprograms}\{#MyAppName} {cm:Settings}"; Filename: "{app}\{#MyAppExeName}";  MinVersion: 6.2.9200;

;Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\{#MyAppIconsFile}"; IconIndex: 1;  Components: main

;--------------------------Windows task----------------------
[Run]
Filename: "schtasks"; \
    Parameters: "/Create /F /SC DAILY /TN ""CheckUpdatesWeblocOpener"" /TR ""start weblocopener -update-silent"""; \
    Flags: runhidden

[UninstallRun]
Filename: "schtasks"; \
    Parameters: "/delete /tn CheckUpdatesWeblocOpener /f"; \
    Flags: runhidden
;------------------------/Windows task-----------------------

[Run]
Filename: https://benchdoos.github.io/; Description: "{cm:ProgramOnTheWeb,{#MyAppName}}"; Flags: postinstall shellexec  unchecked

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

#define MyAppName "WeblocOpener"
#define MyAppPublisher "Eugene Zrazhevsky"
#define MyAppURL "https://benchdoos.github.io/"
#define MyAppExeName "WeblocOpener.exe"
#define MyAppIconsFile "icons.icl"
#define MyAppSourcePath "F:\Developer\JAVA\WeblocOpener"
#define MyAppAdditionalPath "F:\Developer\JAVA\WeblocOpener\build\installer"
#define ImagesPath "F:\Developer\JAVA\WeblocOpener\build\installer\images"
#define ApplicationVersion GetFileVersion('F:\Developer\JAVA\WeblocOpener\build\WeblocOpener.exe')
#define ApplicationCopyright GetFileCopyright('F:\Developer\JAVA\WeblocOpener\build\WeblocOpener.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={{F1300E10-BBB2-4695-AC2F-3D58DC0BC0A6}
AppName={#MyAppName}
AppVersion={#ApplicationVersion}
VersionInfoVersion=1.0
AppCopyright={#ApplicationCopyright}

AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir={#MyAppAdditionalPath}\setup
OutputBaseFilename=WeblocOpenerSetup
LicenseFile={#MyAppAdditionalPath}\languages\license\License.rtf

SetupIconFile={#ImagesPath}\icon.ico
WizardImageFile={#ImagesPath}\WizardImageFile.bmp
WizardSmallImageFile={#ImagesPath}\WizardSmallImageFile.bmp
UninstallDisplayIcon={app}\{#MyAppIconsFile},2

ArchitecturesInstallIn64BitMode=x64

Compression=lzma
SolidCompression=yes
ChangesAssociations=yes
PrivilegesRequired=admin

ShowLanguageDialog=auto
DisableProgramGroupPage=yes

[Registry]
; File association
Root: HKCR; Subkey: ".webloc"; ValueType: string; ValueName: ""; ValueData: "Webloc"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc"; ValueType: string; ValueName: ""; ValueData: {cm:WeblocLink}; Flags: uninsdeletekey
Root: HKCR; Subkey: "Webloc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppIconsFile},3"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue

; Add new file .webloc
Root: HKCR; Subkey: ".webloc\ShellNew"; ValueType: string; ValueName: "ItemName"; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".webloc\ShellNew"; ValueType: string; ValueName: "FileName"; ValueData: "{app}\Template.webloc"; Flags: uninsdeletevalue
Root: HKCR; Subkey: ".webloc\ShellNew"; ValueType: string; ValueName: "NullFile"; ValueData: ""; Flags: uninsdeletevalue

; Add edit file menu
Root: HKCR; Subkey: "Webloc\shell\edit"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",7"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\edit\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-edit"" ""%1"" "; Flags: uninsdeletevalue

; Add qr file menu
Root: HKCR; Subkey: "Webloc\shell\GenerateQRCode"; ValueType: string; ValueName: ""; ValueData: {cm:GenerateQrCode}; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\GenerateQRCode"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",5"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\GenerateQRCode\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-qr"" ""%1"" "; Flags: uninsdeletevalue

; Add copy qr file menu
Root: HKCR; Subkey: "Webloc\shell\CopyQRCode"; ValueType: string; ValueName: ""; ValueData: {cm:CopyQRMenu}; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\CopyQRCode"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",5"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\CopyQRCode\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-copy-qr"" ""%1"" "; Flags: uninsdeletevalue

; Add copy file menu
Root: HKCR; Subkey: "Webloc\shell\Copy"; ValueType: string; ValueName: ""; ValueData: {cm:CopyMenu}; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\Copy"; ValueType: string; ValueName: "icon"; ValueData: """{app}\{#MyAppIconsFile}"",6"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "Webloc\shell\Copy\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""-copy"" ""%1"" "; Flags: uninsdeletevalue

; Add updater autorun
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Update"; ValueData: """start weblocopener -update-silent"""; Flags: uninsdeletevalue

; Add app settings
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: ""; ValueData: ""; Flags: uninsdeletevalue
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "auto_update_enabled"; ValueData: "true"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "browser"; ValueData: "default"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "open_folder_for_qr"; ValueData: "true"; Flags: uninsdeletevalue createvalueifdoesntexist
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "notifications"; ValueData: "true"; Flags: uninsdeletevalue createvalueifdoesntexist

Root: HKCU; Subkey: "SOFTWARE\{#MyAppName}\Capabilities"; ValueType: string; ValueName: "ApplicationDescription"; ValueData: "Open, edit and create .webloc links on Windows"; Flags: uninsdeletevalue
Root: HKCU; Subkey: "SOFTWARE\{#MyAppName}\Capabilities\FileAssociations"; ValueType: string; ValueName: ".webloc"; ValueData: {cm:WeblocLink}; Flags: uninsdeletevalue

; Adds start command to cmd
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\{#MyAppName}.exe"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\{#MyAppName}.exe"; ValueType: string; ValueName: "Path"; ValueData: "{app}\"; Flags: uninsdeletevalue

[Registry]
;delete old entries
;Root: HKCU; Subkey: "<path>"; ValueName: "<Value>"; ValueType: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "current_version"; ValueData: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "install_location"; ValueData: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "name"; ValueData: none; Flags: deletevalue;
Root: HKCU; Subkey: "SOFTWARE\JavaSoft\Prefs\{#MyAppName}"; ValueType: string; ValueName: "url_update_info"; ValueData: none; Flags: deletevalue;

[Languages]
Name: "English"; MessagesFile: "{#MyAppAdditionalPath}\languages\English.isl";
Name: "German"; MessagesFile: "{#MyAppAdditionalPath}\languages\German.isl"
Name: "French"; MessagesFile: "{#MyAppAdditionalPath}\languages\French.isl"
Name: "Italian"; MessagesFile: "{#MyAppAdditionalPath}\languages\Italian.isl"
Name: "Russian"; MessagesFile: "{#MyAppAdditionalPath}\languages\Russian.isl"

[Files]
Source: "{#MyAppSourcePath}\build\WeblocOpener.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppAdditionalPath}\Template.webloc"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ImagesPath}\icons.icl"; DestDir: "{app}"; Flags: ignoreversion

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[InstallDelete]
;Deletes old files
Type: files; Name: "{group}\{#MyAppName} {cm:Update}.lnk";
Type: files; Name: "{commonprograms}\{#MyAppName} {cm:Update}.lnk"
Type: files; Name: "{app}\Updater.jar"
Type: files; Name: "{app}\readme.rtf"

Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\{#MyAppName}\DEBUG"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\{#MyAppName}\INFO"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\{#MyAppName}\WARN"

Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\Updater\DEBUG"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\Updater\INFO"
Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Log\Updater\WARN"

Type: filesandordirs; Name: "{%TEMP}\{#MyAppName}\Updater_.jar"

[Icons]
Name: "{group}\{#MyAppName} {cm:Settings}"; Filename: "{app}\{#MyAppExeName}"; OnlyBelowVersion: 6.1.9;
Name: "{commonprograms}\{#MyAppName} {cm:Settings}"; Filename: "{app}\{#MyAppExeName}";  MinVersion: 6.2.9200;

;Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\{#MyAppIconsFile}"; IconIndex: 1;  Components: main

;--------------------------Windows task----------------------
[Run]
Filename: "schtasks"; \
    Parameters: "/Create /F /SC DAILY /TN ""CheckUpdatesWeblocOpener"" /TR ""start weblocopener -update-silent"""; \
    Flags: runhidden

[UninstallRun]
Filename: "schtasks"; \
    Parameters: "/delete /tn CheckUpdatesWeblocOpener /f"; \
    Flags: runhidden
;------------------------/Windows task-----------------------

[Run]
Filename: https://benchdoos.github.io/; Description: "{cm:ProgramOnTheWeb,{#MyAppName}}"; Flags: postinstall shellexec  unchecked


fix install issues

fix install issues

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

#define MyAppName
#define MyAppVersion
#define MyAppPublisher
#define MyAppURL "http://fhir.org"

[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={{B39DF16F-6D54-4346-BB9E-3C6619BA11A2}
AppName=FHIR Notepad++ plugin
AppVersion=1.x
AppPublisher=Health Intersections
AppPublisherURL=http://healthintersections.com.au
AppSupportURL=http://wiki.hl7.org/index.php?title=FHIR_Notepad%2B%2B_Plugin_Documentation
AppUpdatesURL=http://healthintersections.com.au/FhirServer
DefaultDirName={pf}\Notepad++
DefaultGroupName=FHIR Applications
DisableProgramGroupPage=yes
LicenseFile=C:\work\fhirserver\install\npplicense.txt
InfoBeforeFile=C:\work\fhirserver\install\nppreadme.txt
OutputDir=C:\work\fhirserver\install\build
OutputBaseFilename=npp-install-1.0.39
SetupIconFile=C:\work\fhirserver\Server\fhir.ico
Compression=lzma
SolidCompression=yes
DirExistsWarning=no
DisableDirPage=no
AppVerName=FHIR Notepad++ Plugin 1.0.39

[Components]
Name: "n64"; Description: "64bit Notepad++"; Types: custom; Flags: exclusive
Name: "n32"; Description: "32bit Notepad++"; Types: custom; Flags: exclusive

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

[Files]
Source: "C:\work\fhirserver\exec\32\installer.dll";               Flags: dontcopy;

; 1st, the plug-in itself
Source: "C:\work\fhirserver\Exec\32\fhirnpp.dll";               DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\libeay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\ssleay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\64\fhirnpp.dll";               DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\libeay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\ssleay32.dll";              DestDir: "{app}\plugins\FHIRNpp";  Flags: ignoreversion; Components: n64
Source: "C:\Program Files\Notepad++\allowAppDataPlugins.xml";   DestDir: "{app}";                  Flags: ignoreversion

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"; ValueType: dword; ValueName: "notepad++.exe"; ValueData: "10000"; Flags: createvalueifdoesntexist

[Code]
var
  LoadInstallPage : TOutputProgressWizardPage;

type
  TMyCallback = procedure(IntParam: Integer; StrParam: WideString);

Function MyDllDownloadPackages(mode : PAnsiChar; urls : PAnsiChar; callback: TMyCallback) : PAnsiChar; external 'MyDllDownloadPackages@files:installer.dll stdcall setuponly';

procedure InitCallback(IntParam: Integer; StrParam: WideString);
begin
  LoadInstallPage.SetProgress(intparam, 100);
  LoadInstallPage.SetText(StrParam, '');
end;

procedure InstallPackages;
var
  done : boolean;
  s : String;
  msg : String;
begin
  LoadInstallPage.SetText('Installing R3/R4/CDA Packages...', '');
  LoadInstallPage.SetProgress(0, 100);
  LoadInstallPage.Show;
  try
    s := ',hl7.fhir.core#3.0.1,hl7.fhir.core#4.0.0,hl7.fhir.core#1.0.2';
    repeat
      done := true;
      msg := MyDllDownloadPackages('user', s, @InitCallback);
      if msg <> '' then
        done := MsgBox('Downloading the packages failed : '+msg+#13#10+'Try again? (can be done later through installed applications)', mbError, MB_YESNO) = mrNo;
    until done;
  finally
    LoadInstallPage.Hide;
  end;

end;

Procedure CreatePostInstallPage;
Begin
  LoadInstallPage := CreateOutputProgressPage('Perform Installation tasks', '');
End;

procedure InitializeWizard();
Begin
  CreatePostInstallPage;
End;

procedure CurStepChanged(CurStep: TSetupStep);
Begin
  if (CurStep = ssPostInstall)  Then
    InstallPackages;
End;

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

#define MyAppName
#define MyAppVersion
#define MyAppPublisher
#define MyAppURL "http://fhir.org"

[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={{B39DF16F-6D54-4346-BB9E-3C6619BA11A2}
AppName=FHIR Notepad++ plugin
AppVersion=1.x
AppPublisher=Health Intersections
AppPublisherURL=http://healthintersections.com.au
AppSupportURL=http://wiki.hl7.org/index.php?title=FHIR_Notepad%2B%2B_Plugin_Documentation
AppUpdatesURL=http://healthintersections.com.au/FhirServer
DefaultDirName={pf}\Notepad++
DefaultGroupName=FHIR Applications
DisableProgramGroupPage=yes
LicenseFile=C:\work\fhirserver\install\npplicense.txt
InfoBeforeFile=C:\work\fhirserver\install\nppreadme.txt
OutputDir=C:\work\fhirserver\install\build
OutputBaseFilename=npp-install-1.0.39
SetupIconFile=C:\work\fhirserver\Server\fhir.ico
Compression=lzma
SolidCompression=yes
DirExistsWarning=no
AppVerName=FHIR Notepad++ Plugin 1.0.39

[Components]
Name: "n64"; Description: "64bit Notepad++"; Types: custom; Flags: exclusive
Name: "n32"; Description: "32bit Notepad++"; Types: custom; Flags: exclusive

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

[Files]
Source: "C:\work\fhirserver\exec\32\installer.dll";               Flags: dontcopy;

; 1st, the plug-in itself
Source: "C:\work\fhirserver\Exec\32\fhirnpp.dll";               DestDir: "{app}\plugins";       Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\libeay32.dll";              DestDir: "{app}\plugins\fhir";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\32\ssleay32.dll";              DestDir: "{app}\plugins\fhir";  Flags: ignoreversion; Components: n32
Source: "C:\work\fhirserver\Exec\64\fhirnpp.dll";               DestDir: "{app}\plugins";       Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\libeay32.dll";              DestDir: "{app}\plugins\fhir";  Flags: ignoreversion; Components: n64
Source: "C:\work\fhirserver\Exec\64\ssleay32.dll";              DestDir: "{app}\plugins\fhir";  Flags: ignoreversion; Components: n64
Source: "C:\Program Files\Notepad++\allowAppDataPlugins.xml";   DestDir: "{app}";               Flags: ignoreversion

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"; ValueType: dword; ValueName: "notepad++.exe"; ValueData: "10000"; Flags: createvalueifdoesntexist

[Code]
var
  LoadInstallPage : TOutputProgressWizardPage;

type
  TMyCallback = procedure(IntParam: Integer; StrParam: WideString);

Function MyDllDownloadPackages(mode : PAnsiChar; urls : PAnsiChar; callback: TMyCallback) : PAnsiChar; external 'MyDllDownloadPackages@files:installer.dll stdcall setuponly';

procedure InitCallback(IntParam: Integer; StrParam: WideString);
begin
  LoadInstallPage.SetProgress(intparam, 100);
  LoadInstallPage.SetText(StrParam, '');
end;

procedure InstallPackages;
var
  done : boolean;
  s : String;
  msg : String;
begin
  LoadInstallPage.SetText('Installing R3/R4/CDA Packages...', '');
  LoadInstallPage.SetProgress(0, 100);
  LoadInstallPage.Show;
  try
    s := ',hl7.fhir.core#3.0.1,hl7.fhir.core#4.0.0,hl7.fhir.core#1.0.2';
    repeat
      done := true;
      msg := MyDllDownloadPackages('user', s, @InitCallback);
      if msg <> '' then
        done := MsgBox('Downloading the packages failed : '+msg+#13#10+'Try again? (can be done later through installed applications)', mbError, MB_YESNO) = mrNo;
    until done;
  finally
    LoadInstallPage.Hide;
  end;

end;

Procedure CreatePostInstallPage;
Begin
  LoadInstallPage := CreateOutputProgressPage('Perform Installation tasks', '');
End;

procedure InitializeWizard();
Begin
  CreatePostInstallPage;
End;

procedure CurStepChanged(CurStep: TSetupStep);
Begin
  if (CurStep = ssPostInstall)  Then
    InstallPackages;
End;


Amend r15411, fix Windows installer script

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@15412 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

;;
;; Set up parameters
;;

#if MMArch == "x64"
#  define MMArch_x86amd64 "amd64"
#  define MMArch_x86x64 "x64"
#  define MMArch_bits "64"
#elif MMArch == "Win32"
#  define MMArch_x86amd64 "x86"
#  define MMArch_x86x64 "x86"
#  define MMArch_bits "32"
#else
#  error MMArch must be set to "x64" or "Win32" before including this file
#endif

#define MMStageDir "..\stage\Release\" + MMArch

;;
;; Basic installer setup
;;

[Setup]
AppName=Micro-Manager-1.4
AppVerName=Micro-Manager-1.4
AppPublisher=UCSF
AppPublisherURL=http://www.micro-manager.org
AppSupportURL=http://www.micro-manager.org
AppUpdatesURL=http://www.micro-manager.org
DefaultDirName=C:/Program Files/Micro-Manager-1.4
DefaultGroupName=Micro-Manager-1.4
OutputBaseFilename=MMSetup_{#MMArch_bits}bit
Compression=lzma
SolidCompression=true
VersionInfoVersion=1.4
VersionInfoCompany=(c)University of California San Francisco
VersionInfoCopyright=(c)University of California San Francisco, (c)100XImaging Inc
AppCopyright=University of California San Francisco, 100XImaging Inc
ShowLanguageDialog=yes
AppVersion=1.4
AppID=31830087-F23D-4198-B67D-AD4A2A69147F

#if MMArch == "x64"
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
#endif

[Languages]
Name: eng; MessagesFile: compiler:Default.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

;;
;; Visual C++ redistributables
;;

[InstallDelete]
; Remove VC++ 2008 Redistributable Package installed by previous versions
Type: filesandordirs; Name: {app}\Microsoft.VC90.ATL
Type: filesandordirs; Name: {app}\Microsoft.VC90.CRT
Type: filesandordirs; Name: {app}\Microsoft.VC90.MFC
Type: filesandordirs; Name: {app}\Microsoft.VC90.MFCLOC
Type: filesandordirs; Name: {app}\Microsoft.VC90.OPENMP

[Files]
Source: "..\..\3rdparty\Microsoft\vcredist\2008SP1\vcredist_{#MMArch_x86x64}.exe"; DestDir: "{app}"; DestName: "vcredist_{#MMArch_x86x64}_2008SP1.exe"; Flags: deleteafterinstall
Source: "..\..\3rdparty\Microsoft\vcredist\2010SP1\vcredist_{#MMArch_x86x64}.exe"; DestDir: "{app}"; DestName: "vcredist_{#MMArch_x86x64}_2010SP1.exe"; Flags: deleteafterinstall

[Run]
Filename: "{app}\vcredist_{#MMArch_x86x64}_2008SP1.exe"; Parameters: "/q"; Description: "Microsoft Visual C++ 2008 SP1 Redistributable Package"; StatusMsg: "Installing Microsoft Visual C++ 2008 SP1 Redistributable Package"
Filename: "{app}\vcredist_{#MMArch_x86x64}_2010SP1.exe"; Parameters: "/q"; Description: "Microsoft Visual C++ 2010 SP1 Redistributable Package"; StatusMsg: "Installing Microsoft Visual C++ 2010 SP1 Redistributable Package"

;;
;; Micro-Manager application files
;;

[InstallDelete]
; Remove plugins from toplevel, where they used to reside; at least some of
; them will now be installed in subdirectories of mmplugins.
Type: files; Name: "{app}\mmplugins\ASIdiSPIM.jar"
Type: files; Name: "{app}\mmplugins\AcquireMultipleRegions.jar"
Type: files; Name: "{app}\mmplugins\BFCorrector.jar"
Type: files; Name: "{app}\mmplugins\Big.jar"
Type: files; Name: "{app}\mmplugins\CRISP.jar"
Type: files; Name: "{app}\mmplugins\ClojureEditor.jar"
Type: files; Name: "{app}\mmplugins\DLLAutoReloader.jar"
Type: files; Name: "{app}\mmplugins\DataBrowser.jar"
Type: files; Name: "{app}\mmplugins\Gaussian.jar"
Type: files; Name: "{app}\mmplugins\HCS.jar"
Type: files; Name: "{app}\mmplugins\ImageFlipper.jar"
Type: files; Name: "{app}\mmplugins\IntelligentAcquisition.jar"
Type: files; Name: "{app}\mmplugins\MMTracker.jar"
Type: files; Name: "{app}\mmplugins\MultiCamera.jar"
Type: files; Name: "{app}\mmplugins\MultiChannelShading.jar"
Type: files; Name: "{app}\mmplugins\PixelCalibrator.jar"
Type: files; Name: "{app}\mmplugins\Projector.jar"
Type: files; Name: "{app}\mmplugins\Recall.jar"
Type: files; Name: "{app}\mmplugins\SlideExplorer.jar"
Type: files; Name: "{app}\mmplugins\SlideExplorer2.jar"
Type: files; Name: "{app}\mmplugins\SplitView.jar"
Type: files; Name: "{app}\mmplugins\StageControl.jar"
Type: files; Name: "{app}\mmplugins\pgFocus.jar"
; PixelCalibrator was moved to Beta, but now is back at toplevel.
Type: files; Name: "{app}\mmplugins\Beta\PixelCalibrator.jar"
; PatternOverlay was placed in Image Processing, but was moved to the toplevel.
Type: files; Name: "{app}\mmplugins\Image_Processing\PatternOverlay.jar"
; Image Procssing was renamed to On-The-Fly Proccessors
Type: files; Name: "{app}\mmplugins\Image_Processing\ImageFlipper.jar"
Type: files; Name: "{app}\mmplugins\Image_Processing\MultiChannelShading.jar"
Type: files; Name: "{app}\mmplugins\Image_Processing\SplitView.jar"

; Renamed to NewportCONEX
Type: files; Name: "{app}\mmgr_dal_CONEX.dll"

; Retired
Type: files; Name: "{app}\mmgr_dal_Hamamatsu.dll"

[Files]

; ImageJ files
Source: {#MMStageDir}\ImageJ.exe; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\ij.jar; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\ImageJ.cfg; DestDir: {app}; Flags: onlyifdoesntexist; Permissions: users-modify
Source: {#MMStageDir}\IJ_Prefs.txt; DestDir: {app}; Flags: onlyifdoesntexist; Permissions: users-modify
Source: {#MMStageDir}\macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs

; ImageJ plugins, including Micro-Manager jars
Source: {#MMStageDir}\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs

; DLLs (Java wrapper, device adapters, and vendor DLLs)
; (Note: *.dll covers it all, but the separate patterns result in a cleaner install order)
Source: {#MMStageDir}\MMCoreJ_wrap.dll; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\mmgr_dal_*.dll; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\*.dll; DestDir: {app}; Flags: ignoreversion

; Olympus IX*3 control module
Source: {#MMStageDir}\OlympusIX3Control\*; DestDir: {app}\OlympusIX3Control; Flags: ignoreversion recursesubdirs createallsubdirs

; Micro-Manager plugins
Source: {#MMStageDir}\mmplugins\*; DestDir: {app}\mmplugins; Flags: ignoreversion recursesubdirs createallsubdirs
Source: {#MMStageDir}\mmautofocus\*; DestDir: {app}\mmautofocus; Flags: ignoreversion recursesubdirs createallsubdirs

; BeanShell scripts
Source: {#MMStageDir}\scripts\*; DestDir: {app}\scripts; Flags: ignoreversion

; Configuration files
Source: {#MMStageDir}\MMConfig_demo.cfg; DestDir: {app}; Flags: ignoreversion

; Python wrapper
Source: {#MMStageDir}\_MMCorePy.pyd; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\MMCorePy.py; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\MMCoreWrapDemo.py; DestDir: {app}; Flags: ignoreversion

; MATLAB utility script
Source: {#MMStageDir}\StartMMStudio.m; DestDir: {app}; Flags: ignoreversion

; Java Runtime
Source: {#MMStageDir}\jre\*; DestDir: {app}\jre; Flags: ignoreversion recursesubdirs createallsubdirs

;;
;; Additional install settings
;;

[Dirs]
Name: "{app}"; Permissions: users-modify
Name: "{app}\macros"; Permissions: users-modify
Name: "{app}\plugins"; Permissions: users-modify
Name: "{app}\mmplugins"; Permissions: users-modify
Name: "{app}\mmautofocus"; Permissions: users-modify

[Icons]
Name: {group}\Micro-Manager-1.4; Filename: {app}\ImageJ.exe; WorkingDir: {app}
Name: {group}\{cm:UninstallProgram,Micro-Manager-1.4}; Filename: {uninstallexe}
Name: {commondesktop}\Micro-Manager 1.4; Filename: {app}\ImageJ.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0

[Run]
Filename: "{app}\ImageJ.exe"; WorkingDir: "{app}"; Description: {cm:LaunchProgram,Micro-Manager-1.4}; Flags: nowait postinstall skipifsilent

;;
;; Set up parameters
;;

#if MMArch == "x64"
#  define MMArch_x86amd64 "amd64"
#  define MMArch_x86x64 "x64"
#  define MMArch_bits "64"
#elif MMArch == "Win32"
#  define MMArch_x86amd64 "x86"
#  define MMArch_x86x64 "x86"
#  define MMArch_bits "32"
#else
#  error MMArch must be set to "x64" or "Win32" before including this file
#endif

#define MMStageDir "..\stage\Release\" + MMArch

;;
;; Basic installer setup
;;

[Setup]
AppName=Micro-Manager-1.4
AppVerName=Micro-Manager-1.4
AppPublisher=UCSF
AppPublisherURL=http://www.micro-manager.org
AppSupportURL=http://www.micro-manager.org
AppUpdatesURL=http://www.micro-manager.org
DefaultDirName=C:/Program Files/Micro-Manager-1.4
DefaultGroupName=Micro-Manager-1.4
OutputBaseFilename=MMSetup_{#MMArch_bits}bit
Compression=lzma
SolidCompression=true
VersionInfoVersion=1.4
VersionInfoCompany=(c)University of California San Francisco
VersionInfoCopyright=(c)University of California San Francisco, (c)100XImaging Inc
AppCopyright=University of California San Francisco, 100XImaging Inc
ShowLanguageDialog=yes
AppVersion=1.4
AppID=31830087-F23D-4198-B67D-AD4A2A69147F

#if MMArch == "x64"
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
#endif

[Languages]
Name: eng; MessagesFile: compiler:Default.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

;;
;; Visual C++ redistributables
;;

[InstallDelete]
; Remove VC++ 2008 Redistributable Package installed by previous versions
Type: filesandordirs; Name: {app}\Microsoft.VC90.ATL
Type: filesandordirs; Name: {app}\Microsoft.VC90.CRT
Type: filesandordirs; Name: {app}\Microsoft.VC90.MFC
Type: filesandordirs; Name: {app}\Microsoft.VC90.MFCLOC
Type: filesandordirs; Name: {app}\Microsoft.VC90.OPENMP

[Files]
Source: "..\..\3rdparty\Microsoft\vcredist\2008SP1\vcredist_{#MMArch_x86x64}.exe"; DestDir: "{app}"; DestName: "vcredist_{#MMArch_x86x64}_2008SP1.exe"; Flags: deleteafterinstall
Source: "..\..\3rdparty\Microsoft\vcredist\2010SP1\vcredist_{#MMArch_x86x64}.exe"; DestDir: "{app}"; DestName: "vcredist_{#MMArch_x86x64}_2010SP1.exe"; Flags: deleteafterinstall

[Run]
Filename: "{app}\vcredist_{#MMArch_x86x64}_2008SP1.exe"; Parameters: "/q"; Description: "Microsoft Visual C++ 2008 SP1 Redistributable Package"; StatusMsg: "Installing Microsoft Visual C++ 2008 SP1 Redistributable Package"
Filename: "{app}\vcredist_{#MMArch_x86x64}_2010SP1.exe"; Parameters: "/q"; Description: "Microsoft Visual C++ 2010 SP1 Redistributable Package"; StatusMsg: "Installing Microsoft Visual C++ 2010 SP1 Redistributable Package"

;;
;; Micro-Manager application files
;;

[InstallDelete]
; Remove plugins from toplevel, where they used to reside; at least some of
; them will now be installed in subdirectories of mmplugins.
Type: files; Name: "{app}\mmplugins\ASIdiSPIM.jar"
Type: files; Name: "{app}\mmplugins\AcquireMultipleRegions.jar"
Type: files; Name: "{app}\mmplugins\BFCorrector.jar"
Type: files; Name: "{app}\mmplugins\Big.jar"
Type: files; Name: "{app}\mmplugins\CRISP.jar"
Type: files; Name: "{app}\mmplugins\ClojureEditor.jar"
Type: files; Name: "{app}\mmplugins\DLLAutoReloader.jar"
Type: files; Name: "{app}\mmplugins\DataBrowser.jar"
Type: files; Name: "{app}\mmplugins\Gaussian.jar"
Type: files; Name: "{app}\mmplugins\HCS.jar"
Type: files; Name: "{app}\mmplugins\ImageFlipper.jar"
Type: files; Name: "{app}\mmplugins\IntelligentAcquisition.jar"
Type: files; Name: "{app}\mmplugins\MMTracker.jar"
Type: files; Name: "{app}\mmplugins\MultiCamera.jar"
Type: files; Name: "{app}\mmplugins\MultiChannelShading.jar"
Type: files; Name: "{app}\mmplugins\PixelCalibrator.jar"
Type: files; Name: "{app}\mmplugins\Projector.jar"
Type: files; Name: "{app}\mmplugins\Recall.jar"
Type: files; Name: "{app}\mmplugins\SlideExplorer.jar"
Type: files; Name: "{app}\mmplugins\SlideExplorer2.jar"
Type: files; Name: "{app}\mmplugins\SplitView.jar"
Type: files; Name: "{app}\mmplugins\StageControl.jar"
Type: files; Name: "{app}\mmplugins\pgFocus.jar"
; PixelCalibrator was moved to Beta, but now is back at toplevel.
Type: files; Name: "{app}\mmplugins\Beta\PixelCalibrator.jar"
; PatternOverlay was placed in Image Processing, but was moved to the toplevel.
Type: files; Name: "{app}\mmplugins\Image_Processing\PatternOverlay.jar"
; Image Procssing was renamed to On-The-Fly Proccessors
Type: files; Name: "{app}\mmplugins\Image_Processing\ImageFlipper.jar"
Type: files; Name: "{app}\mmplugins\Image_Processing\MultiChannelShading.jar"
Type: files; Name: "{app}\mmplugins\Image_Processing\SplitView.jar"

; Renamed to NewportCONEX
Type: files; Name: "{app}\mmgr_dal_CONEX.dll"

; Retired
Type: files; Name: "{app}\mmgr_dal_Hamamatsu.dll"

[Files]

; ImageJ files
Source: {#MMStageDir}\ImageJ.exe; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\ij.jar; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\ImageJ.cfg; DestDir: {app}; Flags: onlyifdoesntexist; Permissions: users-modify
Source: {#MMStageDir}\IJ_Prefs.txt; DestDir: {app}; Flags: onlyifdoesntexist; Permissions: users-modify
Source: {#MMStageDir}\macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs

; ImageJ plugins, including Micro-Manager jars
Source: {#MMStageDir}\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs

; DLLs (Java wrapper, device adapters, and vendor DLLs)
; (Note: *.dll covers it all, but the separate patterns result in a cleaner install order)
Source: {#MMStageDir}\MMCoreJ_wrap.dll; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\mmgr_dal_*.dll; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\*.dll; DestDir: {app}; Flags: ignoreversion

; Olympus IX*3 control module
Source: {#MMStageDir}\OlympusIX3Control\*; DestDir: {app}\OlympusIX3Control; Flags: ignoreversion recursesubdirs createallsubdirs

; Micro-Manager plugins
Source: {#MMStageDir}\mmplugins\*; DestDir: {app}\mmplugins; Flags: ignoreversion recursesubdirs createallsubdirs
Source: {#MMStageDir}\mmautofocus\*; DestDir: {app}\mmautofocus; Flags: ignoreversion recursesubdirs createallsubdirs

; BeanShell scripts
Source: {#MMStageDir}\scripts\*; DestDir: {app}\scripts; Flags: ignoreversion

; Configuration files
Source: {#MMStageDir}\MMConfig_demo.cfg; DestDir: {app}; Flags: ignoreversion

; Python wrapper
Source: {#MMStageDir}\_MMCorePy.pyd; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\MMCorePy.py; DestDir: {app}; Flags: ignoreversion
Source: {#MMStageDir}\MMCoreWrapDemo.py; DestDir: {app}; Flags: ignoreversion

; MATLAB utility script
Source: {#MMStageDir}\StartMMStudio.m DestDir: {app}; Flags: ignoreversion

; Java Runtime
Source: {#MMStageDir}\jre\*; DestDir: {app}\jre; Flags: ignoreversion recursesubdirs createallsubdirs

;;
;; Additional install settings
;;

[Dirs]
Name: "{app}"; Permissions: users-modify
Name: "{app}\macros"; Permissions: users-modify
Name: "{app}\plugins"; Permissions: users-modify
Name: "{app}\mmplugins"; Permissions: users-modify
Name: "{app}\mmautofocus"; Permissions: users-modify

[Icons]
Name: {group}\Micro-Manager-1.4; Filename: {app}\ImageJ.exe; WorkingDir: {app}
Name: {group}\{cm:UninstallProgram,Micro-Manager-1.4}; Filename: {uninstallexe}
Name: {commondesktop}\Micro-Manager 1.4; Filename: {app}\ImageJ.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0

[Run]
Filename: "{app}\ImageJ.exe"; WorkingDir: "{app}"; Description: {cm:LaunchProgram,Micro-Manager-1.4}; Flags: nowait postinstall skipifsilent


Switch to MsiEnumRelatedProducts for client check

#ifndef VERSION
#define VERSION '0.0.0'
#endif

#ifndef VERSIONFULL
#define VERSIONFULL '0.0.0-UNKNOWN'
#endif

#define APPNAME 'FoundationDB SQL Layer'
#define FDB_UPGRADE_GUID '{A95EA002-686E-4164-8356-C715B7F8B1C8}'
#define FDB_VERSION_STR '1.0.1'
#define FDB_VERSION_NUM '$01000001'

[Setup]
OutputBaseFilename = fdb-sql-layer
AppName = {#APPNAME}
AppVerName = {#APPNAME} {#VERSION}
AppPublisher = FoundationDB, LCC
AppPublisherURL = https://foundationdb.com/
AppVersion = {#VERSION}
VersionInfoProductTextVersion = {#VERSIONFULL}
DefaultDirName = {code:DefaultInstallPath}
DefaultGroupName = foundationdb
Compression = lzma
SolidCompression = yes
MinVersion = 5.1
PrivilegesRequired = admin
ArchitecturesInstallIn64BitMode=x64 ia64
LicenseFile=LICENSE-SQL_LAYER.txt
DirExistsWarning = no
SetupIconFile = foundationdb.ico
WizardImageFile = dialog.bmp
WizardSmallImageFile = banner.bmp
WizardImageStretch = no
WizardImageBackColor = clWhite
InfoAfterFile = conclusion.rtf
;SignTool=GoDaddy

[Tasks]
;Always run as Service, SYSTEM user, and start with windows

[Dirs]
Name: "{code:AppDataDir}\logs\sql"
Name: "{code:AppDataDir}\sql-config"

[Files]
Source: "LICENSE-SQL_LAYER.txt"; DestDir: "{app}"
Source: "bin\*"; DestDir: "{app}\bin"; AfterInstall: EditAfterInstall
Source: "config\*"; DestDir: "{code:AppDataDir}\sql-config"; AfterInstall: EditAfterInstall; Flags: onlyifdoesntexist uninsneveruninstall
Source: "lib\*"; DestDir: "{app}\sql\lib"; Flags: recursesubdirs
Source: "procrun\*"; DestDir: "{app}\sql\procrun"; Flags: recursesubdirs

[Icons]
;Name: "{group}\FoundationDB SQL Layer"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "window";  WorkingDir: "{app}"; Comment: "Run the server as an application"
;Name: "{group}\Start Service"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "start";  WorkingDir: "{app}"; Comment: "Start Windows service"
;Name: "{group}\Stop Service"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "stop";  WorkingDir: "{app}"; Comment: "Stop Windows service"
;Name: "{group}\Monitor Service"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "monitor";  WorkingDir: "{app}"; Comment: "Monitor Windows service"
;Name: "{group}\Uninstall FoundationDB SQL Layer"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "install -m auto"; WorkingDir: "{app}"; StatusMsg: "Installing service ..."; Flags: runhidden
Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "start"; WorkingDir: "{app}"; StatusMsg: "Starting service ..."

[UninstallRun]
Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "uninstall";  WorkingDir: "{app}"; StatusMsg: "Removing service ..."; Flags: runhidden

[Code]
//
// Custom functions
//
#ifdef UNICODE
  #define AW "W"
#else
  #define AW "A"
#endif

function MsiEnumRelatedProducts(lpUpgradeCode: String; dwReserved: DWORD; iProductIndex: DWORD; lpProductBuf: String): UINT;
  external 'MsiEnumRelatedProducts{#AW}@msi.dll stdcall';

function FindJava(): String;
var
  JavaLoc : String;
  JavaVersion : String;
  JavaInstalled : Boolean;
begin
  Result := '';
  JavaLoc := 'SOFTWARE\JavaSoft\Java Runtime Environment';
  JavaInstalled := RegKeyExists(HKLM, JavaLoc);

  if not JavaInstalled then begin
    JavaLoc := 'SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment';
    JavaInstalled := RegKeyExists(HKLM, JavaLoc);
  end;

  if JavaInstalled then
    begin
      if RegQueryStringValue(HKLM, JavaLoc, 'CurrentVersion', JavaVersion) then
        begin
          if CompareStr('1.7', JavaVersion) > 0 then
            Result := 'Java version >= 1.7 is required to run {#APPNAME}';
        end
      else
        Result := 'Unable to detect Java version';
    end
  else
    Result := 'Java is required to run {#APPNAME}';
end;

function FindFDBClient(): String;
var
  I : Integer;
  ProductGUID : String;
  FDBClientVersion : Cardinal;
begin
  I := 0;
  SetLength(ProductGUID, 39);

  while MsiEnumRelatedProducts('{#FDB_UPGRADE_GUID}', 0, I, ProductGUID) = 0 do
  begin
    SetLength(ProductGUID, 39);
    I := I + 1;
  end;

  Result := '';
  if I = 0 then
    Result := 'No FoundationDB found. Version >= {#FDB_VERSION_STR} required to run {#APPNAME}'
  else if I > 1 then
    Result := 'Error: Multiple FoundationDB installations found.'
  else
    begin
      if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + ProductGUID, 'Version', FDBClientVersion) then
        begin
          if FDBClientVersion < {#FDB_VERSION_NUM} then
            Result := 'FoundationDB Client version >= {#FDB_VERSION_STR} required to run {#APPNAME}';
        end
      else
        Result := 'Error: No such product ' + ProductGUID;
    end;
end;

function ExpandKey(Key: String) : String;
var
  Value: String;
begin
  if Key = 'datadir' then
    Value := '{code:AppDataDir}\data\sql'
  else if Key = 'confdir' then
    Value := '{code:AppDataDir}\sql-config'
  else if Key = 'logdir' then
    Value := '{code:AppDataDir}\logs\sql'
  else if Key = 'tempdir' then
    Value := '{%TEMP}'
  else
    Value := '';
  Value := ExpandConstant(Value);
  StringChange(Value, '\', '/');
  Result := Value;
end;

procedure EditFile(FileName: String);
var
  FileLines: TArrayOfString;
  Index, DollarBrace, EndBrace: Integer;
  Key: String;
begin
  if FileExists(FileName) then begin
    LoadStringsFromFile(FileName, FileLines);
    for Index := 0 to GetArrayLength(FileLines) - 1 do begin
      DollarBrace := Pos('${', FileLines[Index]);
      if DollarBrace <> 0 then begin
        EndBrace := Pos('}', FileLines[Index]);
        Key := Copy(FileLines[Index], DollarBrace + 2, EndBrace - DollarBrace - 2);
        Delete(FileLines[Index], DollarBrace, EndBrace - DollarBrace + 1);
        Insert(ExpandKey(Key), FileLines[Index], DollarBrace);
      end
    end;
    SaveStringsToFile(FileName, FileLines, false);
  end;
end;

procedure EditAfterInstall();
var
  Path: String;
  FileName: String;
begin
  Path := ExpandConstant(CurrentFileName);
  FileName := ExtractFileName(Path)
  if (FileName = 'fdbsqllayer.cmd') or (FileName = 'log4j.properties') or (FileName = 'server.properties') then
    EditFile(Path)
end;

function AppDataDir(Param: String): String;
begin
  Result := ExpandConstant('{commonappdata}\foundationdb')
end;

function DefaultInstallPath(Param: String): String;
begin;
  Result := GetEnv('FOUNDATIONDB_INSTALL_PATH');
  if Length(Result) = 0 then
    Result := ExpandConstant('{pf}\foundationdb')
end;

//
// Built-In Events
//

function InitializeSetup(): Boolean;
var
  ErrorMsg : String;
begin
  Result := true;
  ErrorMsg := FindJava()
  if Length(ErrorMsg) > 0 then begin
    MsgBox(ErrorMsg, mbError, MB_OK);
    Result := false;
  end;
  ErrorMsg := FindFDBClient();
  if Length(ErrorMsg) > 0 then begin
    MsgBox(ErrorMsg, mbError, MB_OK);
    Result := false;
  end
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
var
  UninstallKey : String;
  InstallPath : String;
  CmdPath : String;
  ResultCode : Integer;
begin
  UninstallKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#APPNAME}_is1');
  if RegQueryStringValue(HKLM, UninstallKey, 'InstallLocation', InstallPath) then begin
    CmdPath := InstallPath + '\bin\fdbsqllayer.cmd';
    if FileExists(CmdPath) then
      Exec(CmdPath, 'uninstall', InstallPath, SW_HIDE, ewWaitUntilTerminated, ResultCode);
  end;
  Result := '';
end;

#ifndef VERSION
#define VERSION '0.0.0'
#endif

#ifndef VERSIONFULL
#define VERSIONFULL '0.0.0-UNKNOWN'
#endif

#define APPNAME "FoundationDB SQL Layer"

[Setup]
OutputBaseFilename = fdb-sql-layer
AppName = {#APPNAME}
AppVerName = {#APPNAME} {#VERSION}
AppPublisher = FoundationDB, LCC
AppPublisherURL = https://foundationdb.com/
AppVersion = {#VERSION}
VersionInfoProductTextVersion = {#VERSIONFULL}
DefaultDirName = {code:DefaultInstallPath}
DefaultGroupName = foundationdb
Compression = lzma
SolidCompression = yes
MinVersion = 5.1
PrivilegesRequired = admin
ArchitecturesInstallIn64BitMode=x64 ia64
LicenseFile=LICENSE-SQL_LAYER.txt
DirExistsWarning = no
SetupIconFile = foundationdb.ico
WizardImageFile = dialog.bmp
WizardSmallImageFile = banner.bmp
WizardImageStretch = no
WizardImageBackColor = clWhite
InfoAfterFile = conclusion.rtf
;SignTool=GoDaddy

[Tasks]
;Always run as Service, SYSTEM user, and start with windows

[Dirs]
Name: "{code:AppDataDir}\logs\sql"
Name: "{code:AppDataDir}\sql-config"

[Files]
Source: "LICENSE-SQL_LAYER.txt"; DestDir: "{app}"
Source: "bin\*"; DestDir: "{app}\bin"; AfterInstall: EditAfterInstall
Source: "config\*"; DestDir: "{code:AppDataDir}\sql-config"; AfterInstall: EditAfterInstall; Flags: onlyifdoesntexist uninsneveruninstall
Source: "lib\*"; DestDir: "{app}\sql\lib"; Flags: recursesubdirs
Source: "procrun\*"; DestDir: "{app}\sql\procrun"; Flags: recursesubdirs

[Icons]
;Name: "{group}\FoundationDB SQL Layer"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "window";  WorkingDir: "{app}"; Comment: "Run the server as an application"
;Name: "{group}\Start Service"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "start";  WorkingDir: "{app}"; Comment: "Start Windows service"
;Name: "{group}\Stop Service"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "stop";  WorkingDir: "{app}"; Comment: "Stop Windows service"
;Name: "{group}\Monitor Service"; Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "monitor";  WorkingDir: "{app}"; Comment: "Monitor Windows service"
;Name: "{group}\Uninstall FoundationDB SQL Layer"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "install -m auto"; WorkingDir: "{app}"; StatusMsg: "Installing service ..."; Flags: runhidden
Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "start"; WorkingDir: "{app}"; StatusMsg: "Starting service ..."

[UninstallRun]
Filename: "{app}\bin\fdbsqllayer.cmd"; Parameters: "uninstall";  WorkingDir: "{app}"; StatusMsg: "Removing service ..."; Flags: runhidden

[Code]
//
// Custom functions
//

function FindJava(): String;
var
  JavaLoc : String;
  JavaVersion : String;
  JavaInstalled : Boolean;
begin
  Result := '';
  JavaLoc := 'SOFTWARE\JavaSoft\Java Runtime Environment';
  JavaInstalled := RegKeyExists(HKLM, JavaLoc);

  if not JavaInstalled then begin
    JavaLoc := 'SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment';
    JavaInstalled := RegKeyExists(HKLM, JavaLoc);
  end;

  if JavaInstalled then
    begin
      if RegQueryStringValue(HKLM, JavaLoc, 'CurrentVersion', JavaVersion) then
        begin
          if CompareStr('1.7', JavaVersion) > 0 then
            Result := 'Java version >= 1.7 is required to run {#APPNAME}';
        end
      else
        Result := 'Unable to detect Java version';
    end
  else
    Result := 'Java is required to run {#APPNAME}';
end;

function FindFDBClient(): String;
var
  FDBClientVersion : Cardinal;
begin
  Result := '';
  if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{66E3CE1B-CDE3-45E0-9B6F-50949D5F2411}', 'Version', FDBClientVersion) then
    begin
      if FDBClientVersion < $01000000 then
        Result := 'FoundationDB Client version >= 1.0 is required to run {#APPNAME}';
    end
  else
    Result := 'FoundationDB Client required to run {#APPNAME}';
end;

function ExpandKey(Key: String) : String;
var
  Value: String;
begin
  if Key = 'datadir' then
    Value := '{code:AppDataDir}\data\sql'
  else if Key = 'confdir' then
    Value := '{code:AppDataDir}\sql-config'
  else if Key = 'logdir' then
    Value := '{code:AppDataDir}\logs\sql'
  else if Key = 'tempdir' then
    Value := '{%TEMP}'
  else
    Value := ''
  Value := ExpandConstant(Value);
  StringChange(Value, '\', '/');
  Result := Value;
end;

procedure EditFile(FileName: String);
var
  FileLines: TArrayOfString;
  Index, DollarBrace, EndBrace: Integer;
  Key: String;
begin
  if FileExists(FileName) then begin
    LoadStringsFromFile(FileName, FileLines);
    for Index := 0 to GetArrayLength(FileLines) - 1 do begin
      DollarBrace := Pos('${', FileLines[Index]);
      if DollarBrace <> 0 then begin
        EndBrace := Pos('}', FileLines[Index]);
        Key := Copy(FileLines[Index], DollarBrace + 2, EndBrace - DollarBrace - 2);
        Delete(FileLines[Index], DollarBrace, EndBrace - DollarBrace + 1);
        Insert(ExpandKey(Key), FileLines[Index], DollarBrace);
      end
    end;
    SaveStringsToFile(FileName, FileLines, false);
  end;
end;

procedure EditAfterInstall();
var
  Path: String;
  FileName: String;
begin
  Path := ExpandConstant(CurrentFileName);
  FileName := ExtractFileName(Path)
  if (FileName = 'fdbsqllayer.cmd') or (FileName = 'log4j.properties') or (FileName = 'server.properties') then
    EditFile(Path)
end;

function AppDataDir(Param: String): String;
begin
  Result := ExpandConstant('{commonappdata}\foundationdb')
end;

function DefaultInstallPath(Param: String): String;
begin;
  Result := GetEnv('FOUNDATIONDB_INSTALL_PATH');
  if Length(Result) = 0 then
    Result := ExpandConstant('{pf}\foundationdb')
end;

//
// Built-In Events
//

function InitializeSetup(): Boolean;
var
  ErrorMsg : String;
begin
  Result := true;
  ErrorMsg := FindJava()
  if Length(ErrorMsg) > 0 then begin
    MsgBox(ErrorMsg, mbError, MB_OK);
    Result := false;
  end
  ErrorMsg := FindFDBClient()
  if Length(ErrorMsg) > 0 then begin
    MsgBox(ErrorMsg, mbError, MB_OK);
    Result := false;
  end
end;

function PrepareToInstall(var NeedsRestart: Boolean): String;
var
  UninstallKey : String;
  InstallPath : String;
  CmdPath : String;
  ResultCode : Integer;
begin
  UninstallKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#APPNAME}_is1');
  if RegQueryStringValue(HKLM, UninstallKey, 'InstallLocation', InstallPath) then begin
    CmdPath := InstallPath + '\bin\fdbsqllayer.cmd';
    if FileExists(CmdPath) then
      Exec(CmdPath, 'uninstall', InstallPath, SW_HIDE, ewWaitUntilTerminated, ResultCode);
  end;
  Result := '';
end;