0

我最近将我的 mac 更新为 Monterey,我的旧 applescript 不再工作,我收到此错误:“系统事件出错:无法弹出进程“系统偏好设置”的窗口 1 的按钮 1。无效的索引。

老实说,我不知道我应该改变哪一部分。先感谢您。

tell application "System Preferences"
    set current pane to pane "com.apple.preference.displays"
    activate
end tell

tell application "System Events"
    tell process "System Preferences"
        
        click pop up button 1 of window 1
        click menu item 1 of menu 1 of pop up button 1 of window 1
    end tell
end tell

tell application "System Preferences"
    delay 10
    quit
end tell

在此处输入图像描述

4

1 回答 1

0
tell application "System Preferences"
    reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
    activate
end tell

tell application "System Events"
    tell application process "System Preferences"
        click pop up button "Add Display" of window "Displays"
        click menu item 2 of menu 1 of pop up button "Add Display" of window "Displays"
    end tell
end tell

tell application "System Preferences"
    delay 5
    quit
end tell
于 2021-11-13T13:55:56.367 回答