Last active
February 3, 2016 14:46
-
-
Save mlongval/10985693 to your computer and use it in GitHub Desktop.
MacOSX Grayscale Mode Toggle Applescript
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
(* | |
ToggleGrayScaleMode for MacOSX 10.9 Mavericks | |
works as of 15 april 2014 | |
This is an AppleScript UI script to toggle GrayScaleMode in System Preferences. | |
I am red-green colorblind and grayscale helps a lot... | |
Works for me. Hope it can be usefull for you. | |
Mike | |
[email protected] | |
*) | |
tell application "System Preferences" | |
activate | |
tell application "System Events" | |
tell application process "System Preferences" | |
set frontmost to true | |
delay 1 | |
click menu item "Accessibility" of menu "View" of menu bar item "View" of menu bar 1 of application process "System Preferences" of application "System Events" | |
-- add delay if needed | |
delay 1 | |
-- The MAGIC word here is SELECT .... you are SELECTing a row NOT CLICKing a row !!!!!!!!! | |
select row 2 of table 1 of scroll area 1 of window "Accessibility" of application process "System Preferences" of application "System Events" | |
-- Now you can CLICK the checkbox | |
click checkbox "Use grayscale" of window "Accessibility" of application process "System Preferences" of application "System Events" | |
-- add delay if needed | |
delay 1 | |
click menu item "Quit System Preferences" of menu "System Preferences" of menu bar item "System Preferences" of menu bar 1 of application process "System Preferences" of application "System Events" | |
end tell | |
end tell | |
end tell | |
Thanks for developing this! I had another script (similar to @janthenat's); however, it stopped working with El Capitan.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the interest of simplifying... How about this?
(sorry, don't know how to post applescript code properly)
tell application "System Preferences"
activate
reveal anchor "Seeing_Display" of pane "Accessibility"
tell application "System Events" to tell process "System Preferences"
click checkbox "Use grayscale" of window 1
end tell
quit application "System Preferences"
end tell