From 8870050aaa66fcb3e0a476c7e5cf7ee7e4195d97 Mon Sep 17 00:00:00 2001 From: yu <191972707@qq.com> Date: Thu, 29 Oct 2026 15:42:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8B=BE=E5=8F=96=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E7=9F=A9=E9=98=B5=E2=80=94=E2=80=94=E6=A1=8C=E9=9D=A2/?= =?UTF-8?q?=E8=A7=86=E8=A7=89/=E7=AA=97=E5=8F=A3=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E6=8C=89=E7=B1=BB=E5=9E=8B=E6=98=BE=E7=A4=BA=E6=8B=BE=E5=8F=96?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=88=E6=A1=8C=E9=9D=A2=E6=8B=BE=E5=8F=96?= =?UTF-8?q?/=E5=B1=8F=E5=B9=95=E6=A1=86=E9=80=89/=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/panels/Properties.tsx | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/renderer/src/panels/Properties.tsx b/src/renderer/src/panels/Properties.tsx index 724aa6f..978e12d 100644 --- a/src/renderer/src/panels/Properties.tsx +++ b/src/renderer/src/panels/Properties.tsx @@ -443,6 +443,8 @@ function FieldControl({ }) { const raw = node.values[field.key] ?? field.defaultValue; const [picking, setPicking] = useState(false); + const isVisionTarget = /^(OcrOffline_|CV_)/.test(node.componentId); + const isWindowTarget = /^(Window_|System_ConnectRemoteDesktop)/.test(node.componentId); const insertVariable = (expression: string) => { const current = textOf(raw).trim(); @@ -489,6 +491,40 @@ function FieldControl({ setPicking(false); } }; + const pickRegionToField = async () => { + setPicking(true); + try { + const region = await window.rpa.desktop.pickRegion(); + onChange(field.key, region.imagePath); + onToast("已框选并截图:" + region.width + "×" + region.height); + } catch (error) { + onToast(error instanceof Error ? error.message : String(error), "error"); + } finally { + setPicking(false); + } + }; + + const pickWindowToField = async () => { + setPicking(true); + try { + const list = await window.rpa.desktop.pickWindowList(); + if (!list.length) { + onToast("未找到可见窗口", "error"); + return; + } + const numbered = list.map((w: { title: string }, i: number) => (i + 1) + ". " + w.title).join("\n"); + const choice = prompt("选择窗口(输入编号):\n" + numbered); + const idx = Number(choice) - 1; + if (Number.isInteger(idx) && list[idx]) { + onChange(field.key, list[idx].title); + onToast("已选择窗口:" + list[idx].title); + } + } catch (error) { + onToast(error instanceof Error ? error.message : String(error), "error"); + } finally { + setPicking(false); + } + }; if (field.widget === "boolean") { return ( @@ -549,6 +585,16 @@ function FieldControl({ + )} + {isWindowTarget && /title/i.test(field.key) && ( + + )} ) : field.widget === "element" ? (