I’ve configured dummy account and had a bit of a play around in Mail with the AppleScript and a poke around with UI Browser, I can get to the point of referencing a column (using slightly different code to what the GPT suggested.
set messageViewerWindow to first window whose subrole is "AXStandardWindow"
set splitterGroup to first splitter group of messageViewerWindow
set subSplitterGroup to first splitter group of splitterGroup
set scrollArea to first scroll area of subSplitterGroup
set messageList to first table of scrollArea
set subjectColumn to first column of messageList
However, at that point, it seems like you can’t just get of set the width of the column to force it to resize.
Poking around a little further I got to this:
tell application "System Events"
tell process "Mail"
set frontmost to true
delay 1
-- Navigate to the specific window
set messageViewerWindow to first window whose subrole is "AXStandardWindow"
tell messageViewerWindow
-- Navigate
tell splitter group 1
tell splitter group 1
tell scroll area 1
tell table 1
tell column 4
-- Get and set the value of the AXSize attribute
set columnSize1 to value of attribute "AXSize"
set value of attribute "AXSize" to 60000
set columnSize2 to value of attribute "AXSize"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
-- Report back
display dialog "The size of column 4 was " & columnSize1 & ", and is " & columnSize2
Now this got me something that I could read but not change … and a bit of experimentation with the layout confirmed it seemed to be the height, not the width of the column.
I went down to the cell level attributes, but I just couldn’t see anything that corresponded to the width of the cell. Only the height once again. And the same thing for the headings (which appear to be a group of sort buttons).
Unless someone has any other suggestions, I think that means you would need to look at the same way you would do it manually. Trigger a click and drag on the column edge to do the resize. And while technically you could do that, I think the resulting automation would end up being rather fragile and overly complex if your window isn’t starting in exactly the same size, position, and layout, every single time.
I had a quick look around to see if there were any particular alternative mail clients that offered more automation of layout, but nothing came up. Little bits about automation for rules and composition, but not so much on the layout.
Hopefully someone else will have an idea for something robust.