Finder: Resize Name-Column To-Fit

ui_control
finder
applescript

#1

Hey Folks,

For years now I've had a macro to resize the name column of the front Finder window (in list-view) to fit — with a Hot Key Trigger.

For those who don't know — by double-clicking on the resize-widget between the column-headers, you can cause the leftmost column to resize to fit its longest element.

The macro is faster if the AppleScript is a compiled script, and I have provided one in a zip file along with the Keyboard Maestro macro. (You can open the script in the Script Editor to see what it's doing.)

This macro will only work with Yosemite (10.10.x) at this time.

On my system it's even faster than the Mavericks version was.

-Chris

Window { Resize Name Column }.scpt.zip (9.5 KB)
Window { Resize Name Column } Yosemite.kmmacros (3.3 KB)


Resize Columns in the Finder's List View -- Macro
#2

Hi Chris, Is this working for you under El Capitan 10.11.6?


#3

As far as I can see, option-double-clicking on column the separators no longer resizes all columns, it only resizes one column to fit. So this may not actually solve the original problem.


#4

Hey @skillet,

It works for me.

But. There are odd conditions where it won’t work that depend upon window-width and how many columns are showing in list-view.

I don’t recall that ever being true in list-view. I do believe it once was in column-view though.

-Chris


#5

That must be the problem I have several columns showing. I guess I just stick with these in the meantime.

Examples - Skillet Macros - Resize Column.kmmacros (103.1 KB)


#6

Thanks Chris, I just came back to this after thinking I almost found a solution it seems like this AppleScript should work but doesn't.

tell application "Finder"
   set listView to target of front Finder window
   set the current view of front Finder window to list view
   set width of column id name column of list view options of front Finder window to 400
   set width of column id modification date column of list view options of front Finder window to 150
   --etc.
   close front Finder window
   open listView
end tell

I put your AppleScript in my Dropbox folder so it syncs across multiple Macs and added change Finder to List View. Not sure if either of those ideas present other problems though.


#7

Hey @skillet,

Try this:

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2018/01/04 20:10
# dMod: 2018/01/04 20:16 
# Appl: Finder
# Task: Adjust widths of the name column and the mod date column in the front window.
# Libs: None
# Osax: None
# Tags: @ccstone, @Applescript, @Script, @Finder, @Adjust, @Widths, @Name, @Column, @Modification, @Date, @Front, @Window
----------------------------------------------------------------
property nameColumnWidth : 400
property modDateColumnWidth : 150
----------------------------------------------------------------

set otherTarget to path to favorites folder -- For use in getting the view to reset.

tell application "Finder"
   
   set winTarget to target of front window as alias
   
   tell front window
      if its current view ≠ list view then set its current view to list view
      
      tell its list view options
         set width of column id name column to nameColumnWidth
         set width of column id modification date column to modDateColumnWidth
      end tell
      
      -- etc.
      
      set target to otherTarget
      delay 0.05
      set target to winTarget
      
   end tell
   
end tell

----------------------------------------------------------------

-Chris


TUTORIAL VIDEO: Using UI Browser and Keyboard Maeastro
#8

Chris

Just implemented this. After years of being frustrated by the narrow columns. Don't know what took me so long to search KM.

However I can't seem to change "nameColumnWidth." Seems to be stuck on the initial 400 value that you had. I'm going to restart Finder and see if that helps. No change. I'll play with it. I am trying for something like 250 width. Maybe it has something to do with the fact that I've added your script to an "Activate Finder" action.

Thanks for posting this script.


#9

Hey @KBM,

Hmm...

You've tried running the script exactly as is except for changing the nameColumnWidth variable?

property nameColumnWidth : 250

-Chris


#10

The change to 400 seems to be permanent. If I open a new Finder window, it comes up 400. If I close all Finder windows, open a new one, reduce the first column to say 50 pixels and open another Finder window it comes up 400. Better than the tiny width I had before.

I also tried running the script from Script Editor. Wouldn't work if no window was opened and if a window was opened it changed that window to 400.


#11

Hey @KBM,

I didn't have the script check to make certain a window was open, although perhaps I should have.

The macOS plays funny games with the name column width when the window is of a certain size and you have too few columns shown in the window.

Try playing with the window width and adding a couple or three more columns to the window.

-Chris


#12

Thanks

With a total of 7 columns no difference.

Maybe I'll work on it later, but 400px is better than the narrow column I had before. Good enough for now.