Weary of the Finder's sloppy, semi-legible sizing of list view columns, I'm attempting to code an AppleScript solution. Omissions and bugs in the Finder's dictionary make this (to indulge in understatement) challenging. The goal is to have any window display a minimalist list view with a single keystroke, with all columns set to the minimum width that avoids truncation and the window itself sized to its content. Something along these lines…
The primary difficulties I've encountered so far are in the column class of list view options of Finder window.
- visible doesn't accurately reflect the columns' actual state
- setting visible has no effect
- width can be read but setting it has no effect
Nor does it help that the Finder's zoom button hasn't done anything sane or useful since cell phones were the size of a shoebox.
Has anyone attempted a similar project or one that overcame any of the difficulties noted above? One hates to resort to the semi-reliable inelegance of GUI scripting.
Best Answer
I have tested the following script (written to address another question here-- this one--Is it possible to change a Finder List View column width in AppleScript?
That script will set the width of the Name column, in a window viewed as list, to be about as big as it needs to be in order to fit the longest name of an item in the window. It works (for me) in macOS 10.11.6 and 10.12.6.
The key is recognize that you don't "set the width of the name column of window 1." Rather, you "set the width of the name column of the list view options of window 1." That's pseudo-code but it tells the story. See the script for details.