Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I automate the "use dark menu bar and dock" preference in Yosemite?

I love the dark menu bar and dock feature in OSX Yosemite! However, I think it would be perfect if I could change it without having to open System Preferences every time. I have absolutely no experience whatsoever with AppleScript, but I'm trying to figure out how to write an AppleScript that will set the dark setting to on or off. I found this example on macosxautomation.com:


tell application "System Events"

tell appearance preferences

get properties

--> returns: {scroll arrow placement:together, font smoothing limit:4, recent applications limit:10, scroll bar action:jump to next page, double click minimizes:true, recent servers limit:10, appearance:blue, recent documents limit:10, highlight color:{46516, 54741, 65535}, class:appearance preferences object, smooth scrolling:false, font smoothing style:automatic}

set properties to {scroll arrow placement:together at top and bottom, font smoothing limit:4, recent applications limit:10, scroll bar action:jump to here, double click minimizes:true, recent servers limit:20, appearance:blue, recent documents limit:20, highlight color:{0, 0, 32000}, smooth scrolling:true, font smoothing style:light}

end tell

end tell

It looks promising, but those properties are obviously for an older version of OSX. Since I'm so new to this, I don't know how to define a new property to modify. This is what I tried (which didn't work):

tell application "System Events"

tell appearance preferences

get properties

set properties to {Use dark menu bar and Dock:true}

end tell

end tell

This also didn't work (all I did was add quotation marks in line 4):

tell application "System Events"

tell appearance preferences

get properties

set properties to {"Use dark menu bar and Dock":true}

end tell

end tell

Any ideas as to how to do this? Once I have this AppleScript written, I can easily throw it into Automator to make it change with the time of day. I can't wait! Any help is greatly appreciated. Have a wonderful day!

MacBook Air, OS X Yosemite (10.10.5), 256GB, 8GB LPDDR3 1600, 1.6GHz i5

Posted on Aug 29, 2015 3:53 PM

Reply
Question marked as Best reply

Posted on Aug 29, 2015 4:08 PM

The way to find out what is scriptable is to open the Dictionary for that app in Script editor. For the Appearance Suite, you'd see:

User uploaded file

Here is the script to set the dark mode on.

tell application "System Events"

tell appearance preferences

set dark mode to true

end tell

end tell

3 replies

Aug 29, 2015 8:54 PM in response to Barney-15E

You, sir, are a godsend. I put your script in an Automator application and scheduled it to run every evening at 7pm. I also changed "true" to "false" and scheduled that version for 6am every morning. Now I have a computer that adapts to its environment a lot better. Thank you so much! And, as a plus, I learned about the AppleScript dictionary!

How can I automate the "use dark menu bar and dock" preference in Yosemite?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.