<# launch.ps1 - Starts the PyPlayer GUI and prints its numeric PID. PyPlayer is a native PyQt5 (Qt5) desktop app that bundles its own VLC and FFmpeg. Its runtime hook resolves bundled libvlc/ffmpeg relative to the exe's own folder, so we just set the working directory to the install folder and launch pyplayer.exe. Output contract: the FIRST line written to stdout is the numeric PID. A trailing blank line is emitted AFTER the PID so that when this script is captured with $out = & powershell -File launch.ps1 the result is an ARRAY of lines (Object[]) rather than a single String. That makes the harness's $out[0] resolve to the PID line ("5148") instead of the first character of a scalar string ('5' -> [int] 53). Nothing is printed before the PID. #> $ErrorActionPreference = 'Stop' $InstallDir = (Join-Path (Split-Path $PSScriptRoot -Parent) 'install') $ExePath = Join-Path $InstallDir 'pyplayer.exe' # Start the GUI from within its install folder so bundled DLLs/plugins resolve. $proc = Start-Process -FilePath $ExePath -WorkingDirectory $InstallDir -PassThru Write-Output $proc.Id Write-Output ''