@@ -17,14 +17,18 @@ $app = Find-App
1717if (! $app ) {throw ' Phoenix Code was not installed' }
1818$exe = $app.UninstallString.Trim (' "' )
1919Write-Output (" Installed program: " + $app.DisplayName + " " + $app.DisplayVersion )
20- Start-Process - FilePath $exe
20+ $running = Start-Process - PassThru - FilePath $exe - ArgumentList ( " _?= " + ( Split-Path $exe - Parent))
2121$root = [Windows.Automation.AutomationElement ]::RootElement
2222$trueCondition = [Windows.Automation.Condition ]::TrueCondition
2323$scope = [Windows.Automation.TreeScope ]
2424$buttonProp = [Windows.Automation.AutomationElement ]::ControlTypeProperty
2525function Get-Dialog {
2626 foreach ($win in $root.FindAll ($scope ::Children, $trueCondition )) {
27- if ($win.Current.Name -match ' Phoenix Code' -and $win.Current.ClassName -eq ' #32770' ) {return $win }
27+ if ($win.Current.Name -match ' Installer Language|Language Selection' ) {
28+ $ok = $win.FindAll ($scope ::Descendants, $trueCondition ) | Where-Object { $_.Current.Name -eq ' OK' } | Select-Object - First 1
29+ if ($ok ) { $ok.GetCurrentPattern ([Windows.Automation.InvokePattern ]::Pattern).Invoke() }
30+ }
31+ if (($win.Current.Name -match ' Phoenix Code' -or $win.Current.ProcessId -eq $running.Id ) -and $win.Current.ClassName -eq ' #32770' ) {return $win }
2832 }
2933}
3034$limit = [datetime ]::UtcNow.AddSeconds(38 )
3640 $uninstall = $controls | Where-Object { $_.Current.Name.Trim (' &' ) -eq ' Uninstall' -and $_.Current.ControlType -eq [Windows.Automation.ControlType ]::Button } | Select-Object - First 1
3741 }
3842} until ($uninstall -or [datetime ]::UtcNow -gt $limit )
39- if (! $uninstall ) {throw ' The native confirmation dialog or Uninstall button was unavailable.' }
43+ if (! $uninstall ) {
44+ $detail = foreach ($win in $root.FindAll ($scope ::Children, $trueCondition )) {
45+ $win.Current.Name + ' | ' + $win.Current.ClassName + ' | ' + $win.Current.ProcessId
46+ if ($win.Current.Name -match ' Phoenix|Language|Setup|Uninstall' ) {
47+ @ ($win.FindAll ($scope ::Descendants, $trueCondition ) | ForEach-Object { $_.Current.Name })
48+ }
49+ }
50+ $detail += (Get-Process | Where-Object { $_.ProcessName -match ' install|^Au_|phoenix' } | Format-Table Name, MainWindowTitle, MainWindowHandle, Id, SessionId | Out-String )
51+ $detail | Out-File (Join-Path $ArtifactDir ' native-windows.txt' )
52+ throw " The native confirmation dialog or Uninstall button was unavailable: $detail "
53+ }
4054$names = @ ($controls | ForEach-Object { $_.Current.Name } | Where-Object { $_ } | Select-Object - Unique)
4155Write-Output $dialog.Current.Name
4256Write-Output ($names -join ' / ' )
0 commit comments