diff --git a/src/main/capabilities/desktop-uia.ts b/src/main/capabilities/desktop-uia.ts index 89ffd74..7626b41 100644 --- a/src/main/capabilities/desktop-uia.ts +++ b/src/main/capabilities/desktop-uia.ts @@ -254,13 +254,14 @@ if (-not $offscreen) { $rect2 = $el.Current.BoundingRectangle Write-Output (@{ clicked = $ok; method = $method; name = $el.Current.Name; x = [int]$rect2.X; y = [int]$rect2.Y; w = [int]$rect2.Width; h = [int]$rect2.Height } | ConvertTo-Json -Compress)`; } -function setValueScript(t: UiaTarget, value: string): string { +export function setValueScript(t: UiaTarget, value: string): string { const s = t.selector; return `${UIA_USING} ${FIND_HELPER} try { $parent = Find-RpaWindow ${psString(s.window ?? "")} $el = Find-RpaElement $parent ${psString(s.name ?? "")} ${psString(s.id ?? "")} ${psString(s.type ?? "")} ${psString(s.className ?? "")} ${s.index} +} catch { $el = $null } if ($null -eq $el) { Write-Output "JSON_NOT_FOUND"; exit 0 } $value = ${psString(value)} $method = "value_pattern" @@ -297,6 +298,7 @@ ${FIND_HELPER} try { $parent = Find-RpaWindow ${psString(s.window ?? "")} $el = Find-RpaElement $parent ${psString(s.name ?? "")} ${psString(s.id ?? "")} ${psString(s.type ?? "")} ${psString(s.className ?? "")} ${s.index} +} catch { $el = $null } if ($null -eq $el) { Write-Output "JSON_NOT_FOUND"; exit 0 } $value = $el.Current.Name try { $vp = $el.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern); $value = $vp.Value } catch {} @@ -389,3 +391,5 @@ register("Element_WaitElementGround", waitElementGround); + +