diff --git a/memory/adb_ui.py b/memory/adb_ui.py index e69cf743..08b74e63 100644 --- a/memory/adb_ui.py +++ b/memory/adb_ui.py @@ -1,4 +1,6 @@ # adb_ui.py - 一键dump+解析Android UI (u2优先,原生fallback) +# 要先看 computer_use.md;dump配合ui_detect,微信/支付宝小程序常需detect补盲 +# 搜索框一般直接输入拼音/首字母即可,别硬啃 adb 中文输入 # u2 (uiautomator2) 不受idle限制,适合动画密集app(美团等) # 弹窗检测: ui(clickable_only=True, raw=True) 找全屏FrameLayout+底部小ImageView(关闭X) # 已知包名: 美团外卖=com.sankuai.meituan.takeoutnew 淘宝=com.taobao.taobao diff --git a/memory/computer_use.md b/memory/computer_use.md index ddd3b66b..310f489e 100644 --- a/memory/computer_use.md +++ b/memory/computer_use.md @@ -6,7 +6,7 @@ L3 memory: ljqCtrl.py ljqCtrl_sop.md ui_detect.py 枚举窗口总是可用:GUI任务先用 win32gui 枚举标题/类名/rect,确定目标窗口、前台状态和客户区原点后再操作。 优先使用 Python UIA;若UIA可用,探测和操作均可使用UIA;游戏不使用UIA; 一旦 UIA 对该窗口无效,立刻改用 ui_detect 定位; -ui_detect 不足时才用 vision,vision 只用于语义理解、确认界面状态和辅助判断目标,不可信其坐标,不要直接按 vision 坐标点击。 +ui_detect 不足时才用 vision,vision 只用于语义理解、确认界面状态和辅助判断目标,不可信其坐标 Windows 下窗口截图和操作使用 ljqCtrl:严禁 pyautogui;记得先 Activate 到前台; 坑1-DPI:一律物理坐标;坑2-遮盖/失焦:混乱先枚举窗口确认前台; ui_detect 的 bbox 是截图内坐标,点击前必须用 `ClientToScreen(hwnd,(0,0))/dpi_scale + bbox中心` 转屏幕物理坐标 @@ -20,3 +20,6 @@ ljqCtrl 失效或目标为网络游戏时,必须使用硬件键鼠 Xbananakb / 明确一个操作后,可以在同一轮执行该动作,短暂等待,再立刻枚举窗口 + 截图/ui_detect 验证新状态;不要在未知状态下把多步决策写进大脚本 尽量不要预测关键词筛候选,应看 detect 输出、坐标、层级和上下文判断 若确定UIA可用则少用ui_detect/ljqCtrl;若UIA不可用,则后续不用UIA + +临时截图/可视化文件用后清理,或固定文件名覆盖,避免堆积。 +ui_detect 可跨端复用;手机端沿用本原则时,UIA 换成 ui dump/adb_ui,ljqCtrl 控制换成 adb diff --git a/memory/ui_detect.py b/memory/ui_detect.py index e0ff9205..103dff4d 100644 --- a/memory/ui_detect.py +++ b/memory/ui_detect.py @@ -157,7 +157,7 @@ def detect(image_path, mode='match', conf=0.25, iou_thresh=0.5): return elements def visualize_for_debug(image_path, elements, output_path=None): - """调试用: 可视化元素列表""" + """Only use when user wants to DEBUG!""" from PIL import ImageFont img = Image.open(image_path) draw = ImageDraw.Draw(img)