【问题标题】:Automate VoiceOver being controlled by AppleScript由 AppleScript 控制的自动旁白
【发布时间】:2022-01-21 13:43:15
【问题描述】:

我正在尝试找到一种方法来自动检查VoiceOver Utility.app 上的Allow VoiceOver to be controlled with AppleScript 选项,以便AppleScript 可以控制VoiceOver。专门用于 GitHub 操作 macos 工作流。

据我所知,是否启用此功能取决于 /private/var/db/Accessibility/.VoiceOverAppleScriptEnabled 文件的存在(包含单个字符 a - 通过挖掘 VoiceOver Utility / ScreenReaderCore.framework 确定),但是这个目录有 SIP,所以写文件是不行的(禁用 SIP 不是一个选项)。

它似乎还试图导入 .voprefs 文件并将 SCREnableAppleScript 键设置为 true 被忽略。

尝试编写 UI 脚本单击复选框似乎只是在 GitHub 操作中对 macos-11 或 macos-10.15 环境执行任何操作,并且最终状态的屏幕截图看起来根本没有发生任何事情(复选框保持未选中状态,否SecurityAgent 弹出窗口等标志)。为了完整起见,这是我尝试过的脚本:

delay 2

log "Starting AppleScript..."

do shell script "mkdir -p ./screenshots"
do shell script "screencapture ./screenshots/starting.png"

log "Activating VoiceOver Utility..."
tell application "VoiceOver Utility" to activate

delay 1

tell application "System Events"
    repeat while not (exists window 1 of application process "VoiceOver Utility")
        delay 0.1
    end repeat

    do shell script "screencapture ./screenshots/activated.png"

    log "Ticking checkbox..."

    tell application process "VoiceOver Utility"
        repeat until (exists checkbox 2 of splitter group 1 of window 1)
            delay 0.1
        end repeat

        click checkbox 2 of splitter group 1 of window 1
    end tell

    delay 2

    do shell script "screencapture ./screenshots/checkbox.png"
end tell

log "Quiting VoiceOver Utility..."
tell application "VoiceOver Utility"
  quit
end tell

有什么想法吗?!

【问题讨论】:

  • 奇怪的是,如果我用sudo(即sudo /System/Applications/Utilities/VoiceOver\ Utility.app/Contents/MacOS/VoiceOver\ Utility)打开VoiceOver Utility.app,我可以在本地重新创建AppleScript“什么都不做”行为 - 尝试勾选复选框然后没有!在 Monterey 本地正常打开似乎与 AppleScript 一起工作正常。好奇这是否是虚拟环境中用户设置的怪癖????

标签: macos applescript voiceover


【解决方案1】:

在与维护人员进行了一些协作后,现在可以开箱即用地使用 AppleScript 控制 VoiceOver 来执行 GitHub 操作。现在默认勾选有问题的复选框。

问题:https://github.com/actions/virtual-environments/issues/4770

公关:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-05
    • 1970-01-01
    • 2012-02-12
    • 1970-01-01
    • 2016-04-08
    • 2017-08-25
    • 1970-01-01
    相关资源
    最近更新 更多