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
You look in the System Events AppleScript dictionary. The dark mode property is a boolean.
Makes sense adding AppleInterfaceStyleSwitchesAutomatically with value
hidden plist file which path is ~/Library/Preferences/.GlobalPreferences.plist
I can’t test this suggestion now, because I have to go at work.
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:
do shell script ("defaults read .GlobalPreferences AppleInterfaceStyleSwitchesAutomatically")
on error number 1
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…