As you may remember I only recently upgraded to Yosemite.
A major annoyance of this was my Finder resize-name-column macro breaking due to changes in the window structure.
I thought it was going to be hard to fix, so I left it on the back burner for some while.
Today I got especially annoyed and had some time, so I looked into the fix.
I ended up deciding to use the static-text of the column-header as an anchor, and I thought I was going to have to account for variations caused by the sort-widget (is it there/is it not there).
But then it occurred to me to use column-2 as the anchor-point, and everything fell into place.
The script works on my 10.10.5 system with a window in list-view even if the sidebar is hidden or the toolbar is hidden.
It also works so far in search windows.
I'm using Keyboard Maestro as the doulbe-click-agent, because it's way faster than other solutions I've tried.
Enjoy.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2014/10/05 11:02
# dMod: 2015/08/16 19:37
# Appl: Finder & System Events & Keyboard Maestro
# Task: Expand/Contract Name column to fit
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @System_Events, @Expand, @Name, @Column
# Test: OSX 10.10.5
-------------------------------------------------------------------------------------------
tell application "Finder"
if current view of front window ≠ list view ¬
then error "View of front Finder window is not list view!"
end tell
tell application "System Events"
set quit delay to 0
tell application "System Events"
tell application process "Finder"
tell (first window whose subrole is "AXStandardWindow")
tell static text 2 of scroll area 1 of splitter group 1 of splitter group 1
set {x, Y} to position
set x to x - 10
set Y to Y + 5
end tell
end tell
end tell
end tell
end tell
setKMVar({varName:"X", varValue:x})
setKMVar({varName:"Y", varValue:Y})
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on setKMVar(varRec) -- Record Format: {varName:"text", varValue:"text"}
set {varName, varValue} to varRec's {varName, varValue}
tell application "Keyboard Maestro Engine"
try
set value of variable varName to varValue
on error
make new variable with properties {name:varName, value:varValue}
end try
end tell
end setKMVar
-------------------------------------------------------------------------------------------