October 23, 2013 at 11:34 PM by Dr. Drang
In this post from a few weeks ago, I said that one of the reasons the Finder is a pretty good photo management tools is that you can use icon view to preview a folder of photos. What makes this work is the Finder’s ability, through the little slider in the lower right corner of the window, to resize the icons up to 512×512 pixels. Because I normally use the Finder’s list view, I have a simple AppleScript that automates the view change, the icon resizing, and the rearrangement of the larger icons.
Switching from list to icon view usually leaves the window looking like this,1 with icons that are too small to see any detail in:
You can drag the slider to the right to make the preview icons bigger, but that isn’t especially precise and, for some Finder settings,2 will leave you with a window that needs to be scrolled both vertically and horizontally to see all the images. Choosing View▸Arrange By▸Name (⌃⌘1) rearranges the icons to fit within the width of the window.
Repeating these three steps every time I open a folder of photos is too much work, especially the dragging of the slider. This little AppleScript does everything in one fell swoop:
applescript: 1: tell application "Finder" 2: set the current view of front Finder window to icon view 3: set icon size of icon view options of front Finder window to 256 4: set arrangement of icon view options of front Finder window to arranged by name 5: end tell
I have it saved under the name “Big photo icons” in
~/Library/Scripts/Applications/Finder and have set up FastScripts to run it when I press ⌃⌥⌘B. When I do, it gives me this:
I find the 256×256 icon size to be good compromise. Big enough to see the detail needed to identify the photo, but small enough to fit several photos in the window. I typically make the window really big on the 27″ iMac at work.
This script apparently doesn’t work in Mavericks. According to a few people on Twitter, it doesn’t throw an error, but the icons don’t change size—at least not immediately. Making another window active and then returning might trigger the icon size change. This is mysterious, and since I don’t intend to update to Mavericks for a while (I prefer a working email client), it’ll have to stay a mystery unless some helpful soul sends me a fix in the meantime.
Well, I now have a computer running Mavericks, and I managed to get the script working, thanks to some hints provided by Paul Calnan and Rob Mathers shortly after the original post was published. According to the Finder’s AppleScript dictionary, the
icon view options property of a Finder window is read-only, so the following script shouldn’t work, but it does.
applescript: 1: tell application "Finder" 2: set thisFolder to target of front Finder window 3: set the current view of front Finder window to icon view 4: set icon size of icon view options of front Finder window to 256 5: set arrangement of icon view options of front Finder window to arranged by name 6: close front Finder window 7: open thisFolder 8: end tell 9:
Lines 2, 6, and 7 are new, and they basically close the window and reopen it. Why do the changes “take” when the window is closed and reopened? I have no idea. This behavior is clearly a bug, and it’s likely that some update will fix the bug and make this horrible kludge unnecessary. But until that day, I need a script that works. This one does.
This is a folder of screenshots, not photos, but the principle is the same. ↩︎
On one of my computers, the icons rearrange themselves automatically as I resize them so there’s no need for horizontal scrolling. On the other computer, the icons don’t rearrange themselves. I’m not sure which setting controls this behavior, but I don’t need to, as the script handles it. ↩︎