You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在AppleScript中点击静态文本?微信代理设置脚本异常求助

解决AppleScript点击微信代理设置“Save”按钮返回missing value的问题

你的问题出在误将“Save”识别为static text控件——实际上它是一个button控件,原脚本找不到目标元素才返回missing value。

修正后的脚本

直接把原脚本里的static text替换为button即可,同时建议增加短延迟确保窗口和控件加载完成:

tell application "WeChat" to activate
delay 0.2

tell application "System Events"
    tell process "WeChat"
        click menu item "Proxy Settings..." of menu "WeChat" of menu bar 1
        delay 0.5
        set frontmost to true
        click radio button "Don't Use" of window "Proxy Settings"
        delay 0.3
        click button "Save" of window "Proxy Settings"
    end tell
end tell

验证控件类型的方法

如果后续遇到类似控件识别错误的问题,可以用系统自带工具确认控件类型:

  • 打开「Script Editor」(脚本编辑器)
  • 点击菜单栏「显示」→「显示UI元素检视器」
  • 选中微信的代理设置窗口,在检视器里查看“Save”对应的控件类型和层级路径

内容的提问来源于stack exchange,提问作者huangtingzhong

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 08:56:07