feat: enhance AI pane picking with OCR and cancellable hotkeys

This commit is contained in:
yu committed 2026-11-02 14:21:19 +08:00
1 parent 0132871885
commit 1ddd1f1b35
10 files changed
+496 -33

No files matched your search

+7 -3
View File
@@ -192,6 +192,7 @@ $prevSpace = $false
$prevPgUp = $false
$prevPgDn = $false
$prevF2 = $false
$prevF4 = $false
$cacheX = [int]::MinValue
$cacheY = [int]::MinValue
$cacheEl = $null
@@ -213,6 +214,7 @@ while ($true) {
$pgUp = (([RpaPick.PickW32]::GetAsyncKeyState(33) -band 0x8001) -ne 0)
$pgDn = (([RpaPick.PickW32]::GetAsyncKeyState(34) -band 0x8001) -ne 0)
$f2 = (([RpaPick.PickW32]::GetAsyncKeyState(113) -band 0x8001) -ne 0)
$f4 = (([RpaPick.PickW32]::GetAsyncKeyState(115) -band 0x8001) -ne 0)
if ($esc) { Write-PickLog "esc"; break }
if ($stage -eq "hover") {
$ptX = [System.Windows.Forms.Cursor]::Position.X
@@ -256,11 +258,12 @@ while ($true) {
$el = $cacheEl
if ($el) {
Set-HighlightBox $cachePaneX $cachePaneY $cachePaneW $cachePaneH
$aiHint = if ($cacheCtrlName -eq "Pane") { " [F2]AI识别" } else { "" }
$aiHint = if ($cacheCtrlName -eq "Pane") { " [F2/F4]AI识别" } else { "" }
$infoLabel.Text = "名称: " + $cacheName + " 类型: " + $cacheCtrlName + " [空格]锁定" + $aiHint + " [Esc]取消"
} else { Hide-Highlight }
if ($f2 -and -not $prevF2 -and $el -and $cacheCtrlName -eq "Pane") {
Write-PickLog "f2 ai"
$aiTrigger = ($f2 -and -not $prevF2) -or ($f4 -and -not $prevF4)
if ($aiTrigger -and $el -and $cacheCtrlName -eq "Pane") {
Write-PickLog "f2/f4 ai"
$walker = [System.Windows.Automation.TreeWalker]::ControlViewWalker
$cur = $el
$topTitle = ""
@@ -312,6 +315,7 @@ while ($true) {
$prevPgUp = $pgUp
$prevPgDn = $pgDn
$prevF2 = $f2
$prevF4 = $f4
Start-Sleep -Milliseconds 60
}
$info.Close()
@@ -0,0 +1 @@
["button","field","heading","iframe","image","label","link","text"]