使用applescript更改屏幕刷新率

时间:2019-02-19 11:54:25

标签: macos applescript automator

我目前在办公室用Macbook使用2个屏幕。每天几次,屏幕颜色之一偏向红色光谱。通过将刷新率更改为50,然后又恢复为60,可以使屏幕恢复为正常的颜色。

我想编写脚本,使其在每次登录时自动发生。我当时正在考虑使用applescript和automator来实现这一目标。

到目前为止我在网上发现的内容:

tell application "System Preferences"
 activate
 set current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events"
 tell process "System Preferences"
 click radio button "Display" of tab group 1 of window "BenQ GL2450H (2)"
 delay 1
 ******************************************
 Change refresh rate back and forward, how?
 ******************************************
 end tell
end tell
delay 1
tell application "System Preferences"
 quit
end tell

窗口的外观: enter image description here

1 个答案:

答案 0 :(得分:0)

找到了一个名为cscreen

的shell应用程序

注意:我只有在指定分辨率(-x,-y)时选项-r才能工作

ChangeScreenRefreshRate.sh:

cscreen -s 2 -x 1920 -y 1080 -r 50
sleep 5
cscreen -s 2 -x 1920 -y 1080 -r 60
相关问题