Skip to content

Instantly share code, notes, and snippets.

@HanSooloo
Created April 8, 2020 23:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HanSooloo/259fa73a0755eddf985cff01e3d5bd9f to your computer and use it in GitHub Desktop.
Save HanSooloo/259fa73a0755eddf985cff01e3d5bd9f to your computer and use it in GitHub Desktop.
AppleScript to change TrueTone
tell application "System Events"
if (get name of every application process) contains "System Preferences" then
set _isSysPrefRunning to true
else
set _isSysPrefRunning to false
end if
end tell
log _isSysPrefRunning
use sys : application "System Events"
use prefs : application "System Preferences"
property prefsUI : a reference to process "System Preferences"
property _W : a reference to window "Built-in Retina Display" of prefsUI
property _TT : a reference to checkbox "True Tone" of tab group 1 of _W
property pane : "com.apple.preference.displays"
property anchor : "displaysDisplayTab"
property tab : anchor (my anchor) of pane id (my pane)
set TrueTone to null
if tab ≠ (reveal tab) then return null
tell _TT to if exists then set TrueTone to its value as boolean
click _TT
if _isSysPrefRunning is not true then
quit prefs
end if
tell application "BetterTouchTool"
if TrueTone then
set_string_variable "TrueToneState" to "Enabled"
else
set_string_variable "TrueToneState" to "Disabled"
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment