when you are trying to set application preferences how do you determine what the setting is called when the obvious fails?
the first works as expected but the second does not
tell application "System Events" to tell appearance preferences to set dark mode to true
tell application "System Events" to tell appearance preferences to set dark mode to auto
Don’t alter plist files manually as the setting probably won’t stick.
Don’t don’t suggest people do anything which alters system plist files in any way at all unless you have tested it yourself and found that it does what the OP wants with no undesirable side effects.
I’m sorry, yesterday I was in a hurry to work, but now I was able to test my proposal myself. The following command:
do shell script ("defaults write .GlobalPreferences AppleInterfaceStyleSwitchesAutomatically true")
successfully adds the required key and value to the specified property list, but unfortunately System Preferences.app ignores this change. So makes sense only getting appearance’s auto state using defaults read command:
try
do shell script ("defaults read .GlobalPreferences AppleInterfaceStyleSwitchesAutomatically")
return true
on error number 1
return false
end try
Unfortunately, I have not yet been able to find working solution (without using GUI scripting) to the OP’s question about how to set the auto mode.
NOTE: answering to the title of this topic: the auto constant has do nothing with general appearance settings. It is constant for use with desktop appearance…