-
Notifications
You must be signed in to change notification settings - Fork 0
/
graykale.applescript
40 lines (37 loc) · 1.27 KB
/
graykale.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
-- set_grayscale.applescript
-- alternates between grayscale and normal display with each run.
-- Tested on High Sierra (10.13.6), Mojave (10.14.6), and Catalina (10.15.2, 10.15.7)
-- Revision: 11/19/2019, Upgrade script for Catalina
-- VikingOSX, 12/30/2018, Apple Support Communities, No warranty at all
set os_ver to do shell script "sw_vers -productVersion | cut -d '.' -f1-2"
tell application "System Preferences"
launch
if os_ver < "10.15" then
reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess"
else
reveal anchor "Seeing_ColorFilters" of pane "Accessibility"
end if
end tell
tell application "System Events"
tell application process "System Preferences"
set frontmost to true
delay 1
if os_ver = "10.15" then
tell window "Accessibility"
repeat until exists checkbox "Enable Color Filters" of tab group 1 of group 1
delay 0.01
end repeat
click first checkbox of tab group 1 of group 1
end tell
else if os_ver = "10.14" then
tell group 1 of window "Accessibility"
click checkbox "Use grayscale"
end tell
else if os_ver < "10.14" then
tell window "Accessibility"
click checkbox "Use grayscale"
end tell
end if
end tell
end tell
tell application "System Preferences" to if it is running then quit