fix: UIA Point 类型名修正(System.Windows.Point),脚本循环验证无错误

This commit is contained in:
yu 2026-10-30 12:52:43 +08:00
parent ed9b9daa50
commit e6c34bafe5

View File

@ -8,7 +8,7 @@ Write-PickLog ("=== start Mode=$Mode ===")
Add-Type -AssemblyName UIAutomationClient, UIAutomationTypes, WindowsBase
Add-Type -AssemblyName System.Windows.Forms
Write-PickLog "assemblies ok"
Add-Type -MemberDefinition "[DllImport(\"user32.dll\")] public static extern short GetAsyncKeyState(int key); [DllImport(\"user32.dll\", CharSet = CharSet.Unicode)] public static extern int GetWindowTextW(IntPtr h, System.Text.StringBuilder sb, int max);" -Name PickW32 -Namespace RpaPick | Out-Null
Add-Type -MemberDefinition '[DllImport("user32.dll")] public static extern short GetAsyncKeyState(int key); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int GetWindowTextW(IntPtr h, System.Text.StringBuilder sb, int max);' -Name PickW32 -Namespace RpaPick | Out-Null
Write-PickLog "w32 ok"
if ($Mode -eq "windows") {
$wins = @()
@ -48,7 +48,7 @@ function Set-HighlightBox([int]$x, [int]$y, [int]$w, [int]$h) {
}
function Hide-Highlight { $hl.Hide() }
function Get-DeepestAtPoint([double]$px, [double]$py) {
$point = New-Object System.Windows.Automation.Point($px, $py)
$point = New-Object System.Windows.Point($px, $py)
$cur = [System.Windows.Automation.AutomationElement]::FromPoint($point)
if (-not $cur) { return $null }
for ($depth = 0; $depth -lt 25; $depth++) {