首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如何通过AppleScript更改主显示屏?

要通过AppleScript更改主显示屏,您可以使用以下代码:

代码语言:txt
复制
tell application "System Events"
    set currentDisplay to display 1
    set targetDisplay to display 2
    set currentDisplayId to id of currentDisplay
    set targetDisplayId to id of targetDisplay
    set currentBounds to bounds of currentDisplay
    set targetBounds to bounds of targetDisplay
    set position of currentDisplay to targetBounds
    set position of targetDisplay to currentBounds
end tell

这段代码将主显示屏更改为第二个显示屏,并将原来的主显示屏更改为第一个显示屏。您可以通过更改display 1display 2来更改显示屏的顺序。

请注意,这个代码需要在macOS系统上运行,并且需要在系统偏好设置中启用脚本编辑器。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

领券