<# launch.ps1 - Starts the Information Box GUI desktop application. Outputs ONLY the numeric process ID on the first line (via Write-Output), so the pipeline can capture and manage the process. Standalone: depends only on the published output in the install directory, not on build.ps1 having run in the same session. #> $ErrorActionPreference = 'Stop' $InstallDir = (Join-Path (Split-Path $PSScriptRoot -Parent) 'install') $Exe = Join-Path $InstallDir 'InformationBox.exe' if (-not (Test-Path $Exe)) { throw "Executable not found: $Exe. Run build.ps1 first." } # WPF app. It reads config from ProgramData/AppData (falling back to an embedded # default) and persists per-user settings/logs under LocalAppData. No special # arguments or environment are required to launch the GUI. Set the working # directory to the install folder so relative asset lookups resolve. $proc = Start-Process -FilePath $Exe -WorkingDirectory $InstallDir -PassThru Write-Output $proc.Id # Emit a trailing empty line so that a caller capturing our output with # $out = & powershell -File launch.ps1 # receives an ARRAY (["",""]) rather than a single scalar string. Without # this, PowerShell collapses a lone line into a [string], and $out[0] indexes # the first CHARACTER of the PID instead of the PID itself. The PID remains the # first (and only non-empty) line. Write-Output ''