/
set_display_resolutions.applescript
47 lines (43 loc) 路 1.77 KB
/
set_display_resolutions.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
-- set resolution of MacBook Pro display
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
set isScaled to value of radio button "Scaled" of tab group 1
if isScaled = 0 then
click radio button "Scaled" of tab group 1
click radio button 5 of radio group 1 of group 1 of tab group 1
else
set scaleValue to value of radio group 1 of group 1 of tab group 1
if scaleValue is not equal to 5 then
click radio button 5 of radio group 1 of group 1 of tab group 1
end if
end if
end tell
-- set resolution of first external display
tell application "System Events" to tell process "System Preferences" to tell window "U28E590 (1)"
set isScaled to value of radio button "Scaled" of tab group 1
if isScaled = 0 then
click radio button "Scaled" of tab group 1
click radio button 3 of radio group 1 of group 1 of tab group 1
else
set scaleValue to value of radio group 1 of group 1 of tab group 1
if scaleValue is not equal to 3 then
click radio button 3 of radio group 1 of group 1 of tab group 1
end if
end if
end tell
-- set resolution of seoncd external display
tell application "System Events" to tell process "System Preferences" to tell window "U28E590 (2)"
set isScaled to value of radio button "Scaled" of tab group 1
if isScaled = 0 then
click radio button "Scaled" of tab group 1
click radio button 3 of radio group 1 of group 1 of tab group 1
else
set scaleValue to value of radio group 1 of group 1 of tab group 1
if scaleValue is not equal to 3 then
click radio button 3 of radio group 1 of group 1 of tab group 1
end if
end if
end tell
quit application "System Preferences"