Created
October 13, 2018 19:04
-
-
Save round/e17e48401e826e68c20537db8a91072c to your computer and use it in GitHub Desktop.
Toggle Grayscale (Mojave)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Preferences" | |
reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess" | |
end tell | |
tell application "System Events" to tell process "System Preferences" | |
repeat while not (exists of checkbox "Use grayscale" of group 1 of window "Accessibility") | |
delay 0.1 | |
end repeat | |
set theCheckbox to checkbox "Use grayscale" of group 1 of window "Accessibility" | |
tell theCheckbox | |
# If the checkbox is not checked, check it to turn grayscale on | |
if not (its value as boolean) then | |
set checked to true | |
click theCheckbox | |
else # else turn grayscale off | |
set checked to false | |
click theCheckbox | |
end if | |
end tell | |
end tell | |
tell application "System Preferences" | |
quit | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment