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

请求重写适用于Monterey 12.6.2的灰度显示AppleScript

Monterey 12.6.2 适配版灰度显示切换AppleScript脚本

原BigSur版本的脚本因Monterey系统偏好设置的UI层级结构变更失效,以下是适配后的可用脚本:

tell application "System Preferences"
    activate
    reveal anchor "Seeing_ColorFilters" of pane id "com.apple.preference.universalaccess"
end tell

tell application "System Events"
    tell process "System Preferences"
        # 等待辅助功能窗口加载完成
        repeat until exists window "Accessibility"
            delay 0.1
        end repeat
        
        tell window "Accessibility"
            tell group 1
                tell tab group 1
                    # 启用颜色滤镜
                    click checkbox "Enable Color Filters"
                    
                    # 选择灰度滤镜(菜单第一项)
                    tell pop up button 1
                        click
                        delay 0.1 -- 确保菜单完全展开
                        click menu item 1 of menu 1
                    end tell
                end tell
            end tell
        end tell
    end tell
end tell

tell application "System Preferences" to quit

核心适配调整

  • 改用面板ID定位辅助功能设置,避免本地化名称差异导致的定位失败
  • 添加窗口加载等待逻辑,防止脚本因UI未就绪执行出错
  • 明确指定目标窗口名称,避免多窗口场景下的元素定位混淆
  • 调整UI元素层级路径,匹配Monterey的界面结构

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 20:05:13