# ===================================================================== # launch.ps1 -- Start the FXOK on-screen keyboard GUI # # Launches the self-contained jpackage app-image produced by build.ps1. # The executable bundles its own JRE + JavaFX, so no JAVA_HOME / module # configuration is required at run time. # # Contract (read by the pipeline): # * prints the numeric PID as the FIRST line (Write-Output) # * no Write-Host, no banner text before the PID # * a trailing blank line follows so the caller receives its captured # stdout as a line ARRAY -> [int]$out[0] yields the PID. (A single # lone line is captured as a scalar STRING, and $out[0] would then # be its first CHARACTER, e.g. '5' -> 53 instead of 5948.) # ===================================================================== $ErrorActionPreference = 'Stop' $ExePath = (Join-Path (Split-Path $PSScriptRoot -Parent) 'install\FXOK\FXOK.exe') # Per-launch working dir under TEMP so repeated relaunches never collide. $workDir = Join-Path $env:TEMP ("fxok-" + [guid]::NewGuid().ToString()) New-Item -ItemType Directory -Force -Path $workDir | Out-Null # StandAloneApp calls showHelp()+System.exit(0) if given ANY raw (unnamed) # argument, so it must be launched with no arguments. $proc = Start-Process -FilePath $ExePath -WorkingDirectory $workDir -PassThru Write-Output $proc.Id Write-Output ''