; Script for GE Aerospace Dashboard Kiosk Installer
; Creates Edge kiosk shortcut to shopfloor-dashboard on Desktop and Startup

[Setup]
AppId={{9D9EEE25-4D24-422D-98AF-2ADEDA4745ED}}
AppName=GE Aerospace Dashboard
AppVersion=1.1
AppPublisher=WJDT
AppPublisherURL=http://tsgwp00525.wjs.geaerospace.net
AppSupportURL=http://tsgwp00525.wjs.geaerospace.net
AppUpdatesURL=http://tsgwp00525.wjs.geaerospace.net
DefaultDirName={autopf}\GE Aerospace Dashboard
CreateAppDir=yes
DisableDirPage=yes
ChangesAssociations=no
PrivilegesRequired=admin
OutputDir=Output
OutputBaseFilename=GEAerospaceDashboardSetup
SolidCompression=yes
WizardStyle=modern
SetupIconFile=gea-logo.ico
WizardImageFile=patrick.bmp
WizardSmallImageFile=patrick-sm.bmp
DisableWelcomePage=no
Uninstallable=yes

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

[Messages]
WelcomeLabel2=This will install the GE Aerospace Dashboard shortcut on your computer.%n%nThe dashboard will open Microsoft Edge in kiosk mode and display the shopfloor dashboard.%n%nA shortcut will be placed on your Desktop and in your Startup folder so it launches automatically when you log in.

[Icons]
; Desktop shortcut (common - all users)
Name: "{commondesktop}\GE Aerospace Dashboard"; Filename: "{commonpf32}\Microsoft\Edge\Application\msedge.exe"; Parameters: "-kiosk https://tsgwp00525.wjs.geaerospace.net/shopdb/shopfloor-dashboard/ --edge-kiosk-type=fullscreen"; IconFilename: "{commonpf32}\Microsoft\Edge\Application\msedge.exe"; Comment: "GE Aerospace Shopfloor Dashboard"

; Startup folder shortcut (common - launches on any user login)
Name: "{commonstartup}\GE Aerospace Dashboard"; Filename: "{commonpf32}\Microsoft\Edge\Application\msedge.exe"; Parameters: "-kiosk https://tsgwp00525.wjs.geaerospace.net/shopdb/shopfloor-dashboard/ --edge-kiosk-type=fullscreen"; IconFilename: "{commonpf32}\Microsoft\Edge\Application\msedge.exe"; Comment: "GE Aerospace Shopfloor Dashboard"

[Registry]
; Auto-start via Run key (backup to startup folder)
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "GE Aerospace Dashboard"; ValueData: """{commonpf32}\Microsoft\Edge\Application\msedge.exe"" -kiosk https://tsgwp00525.wjs.geaerospace.net/shopdb/shopfloor-dashboard/ --edge-kiosk-type=fullscreen"; Flags: uninsdeletevalue

[UninstallDelete]
Type: files; Name: "{commondesktop}\GE Aerospace Dashboard.lnk"
Type: files; Name: "{commonstartup}\GE Aerospace Dashboard.lnk"

[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
  ResultCode: Integer;
begin
  Result := '';
  NeedsRestart := False;
  // Kill any running Edge instances so shortcuts and registry can be updated cleanly
  Exec('taskkill.exe', '/F /IM msedge.exe', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
  // Brief pause to let processes fully exit
  Sleep(1000);
end;
