Automator - Set Folder View Options in Mojave Dark Mode


#1

I mostly prefer my Finder view options set to List View but some folders I want in Icon View. So I have an Automator workflow set up as a Service so I can right-click in the Finder to change the view options to how I want them on those folders.

If you manually create a folder and set its view options to icon view in Finder, the background can be set to Default, which in Dark Mode gives a nice dark color to match the rest of the UI.

But as you can see in the Automator action pictured above, the only options there are White, Color and Picture, which were the options available in Finder before Mojave introduced Dark Mode. Clearly, Apple didn’t update the Finder’s Automator actions. You can use the color picker to set Color to the same color you get through manually changing the view options, but the icon text stays black instead of turning white as it will when you manually set the options. And there’s no way to set the text color.

Finder window - Background set manually
Finder window - Background set through Automator

The Finder’s AppleScript dictionary also doesn’t offer a solution, because again you can set the RGB values of the background but the text won’t be adjusted. And there’s apparently no way to set it to Default like you can manually.

So is there any way to automate the effect of selecting Default from the View Options window in Finder?

My current solution is to use AppleScript GUI scripting from a Keyboard Maestro macro, triggered by a key combination, but that means I need to go into each folder individually and trigger the macro… and that sucks for more than a handful of folders.


#2

You can change the view options of a folder with AppleScript (which you can use in Automator).

set theFolder to "iMac-FV:Users:frank:Desktop:aFolder"
tell application "Finder"
	open theFolder
	tell window 1
		set current view to icon view
	end tell
	close window 1
end tell

After that you can change the options of the view with the following script:

set theFolder to "iMac-FV:Users:frank:Desktop:aFolder"
tell application "Finder"
	open theFolder
	tell the icon view options of window 1
		set the icon size to 192    
	end tell
close window 1
end tell

Changing the icon size will only work in icon view.

If you want to set other options also you can add them to the “tell the icon view options of window 1” block.

How to sort:

set the arrangement to arranged by name

You can also change the Background color like:

set the background color to  {65535, 65535, 65535}

This is the code for Default in the Background section of the Folder info, if I look at the background color code of a newly created folder.

But if I set the background color to {65535, 65535, 65535} I get {65535, 65533, 65534} instead, this is the color code for a white background and this background stays white when you change to Dark Mode. Under High Sierra the background code is also set to {65535, 65533, 65534}.

So like you said Apple needs to fix Automator (and also AppleScript) for this.