How to Adjust Column Width in Apple Mail or Finder List View

I am using Apple Mail version 16. Also I am using column layout.

Q: Does anyone have any idea using keyboard maestro - how to adjust the column width? So for example the column: from or subject or date received could be wider or narrower by a particular amount?

ALSO IN FINDER...

I am using Ventura version 13.6.7

In Finder, I use: view as list...

Q: Same question as above is there someway to adjust the column width for example : name or date modified or kind etc.?

The best way to do this would be through AppleScript, but that depends on whether Apple Mail/Finder allows this control using AppleScript. Let's wait for an AppleScript expert to answer that.

But if there is no way to do it with AppleScript, there will be a way to do it using Find Image in KM. And it will be very simple. For example, this will adjust (rightwards) the rightmost column in Mail by 4 pixels:

I didn't upload the macro, just a screenshot, because you will have to create it yourself, due to screen resolution issues.

Using Find Image requires occasional trial and error, and a little experience, while Using AppleScript is reliable and accurate.

Thanks for the Info. I will give it a try. Also That would be nice to know if there is a way to do this with AppleScript.

My example code might give you something to try in the meantime. Be advised that knowing what images to search for, and using "offsets" as I did ("-3") is a technique that may require a little imagination or experience. There are some apps that don't provide good "image hooks" but when I looked at Mail and Finder briefly, I believe you can find good image hooks for your purposes in those apps.

The issue you have to consider is how you want to trigger your macros. Do you want a separate trigger hotkey for each column and each direction? That could use a dozen hotkeys. This issue is relevant even if you switch to AppleScript.

P.S. Since you probably will press this trigger multiple times in a row quickly, it's probably wise to start the macro with a "Semaphore lock" action to ensure that two copies don't run at the exact same time.

1 Like

You can't do this directly, AFAIK, but you can use either image detection or AppleScript GUI scripting to get the current position of the column divider then use that as a click-drag action's target.

This could give you a starting point for the AS route, the rest of the thread could help with an image detection macro.

1 Like

Thanks for the good ideas. I went in record in Script editor and it created the code below for Ventura. A good start (the width is dependent on the window size BTW). Next I will look at same for Apple Mail.

tell application "Finder"
	activate
	set current view of Finder window 1 to column view
	set current view of Finder window 1 to list view
	set sort direction of column id name column of list view options of Finder window 1 to normal
	set width of column id name column of list view options of Finder window 1 to 300
end tell

Thanks for your help,

I am Rusty with AppleScript
So, I am looking into scripting with AppleScript for Apple Mail

I went to the script editor and shows open dictionary for Apple Mail.
There are many elements and I did find something related = window

I am quite Rusty with programming AppleScript

  • I did try recording in the script a editor but nothing happened with Apple Mail.
  • I am curious if anybody can help get me started:
  • trying to resize some columns (using column layout) using Apple mail Ventura?
    example mailbox: “MainBox” - columns: From, Subject etc.

window n : A window.
elements
contained by application.
properties
name (text, r/o) : The title of the window.
id (integer, r/o) : The unique identifier of the window.
index (integer) : The index of the window, ordered front to back.
bounds (rectangle) : The bounding rectangle of the window.
closeable (boolean, r/o) : Does the window have a close button?
miniaturizable (boolean, r/o) : Does the window have a minimize button?
miniaturized (boolean) : Is the window minimized right now?
resizable (boolean, r/o) : Can the window be resized?
visible (boolean) : Is the window visible right now?
zoomable (boolean, r/o) : Does the window have a zoom button?
zoomed (boolean) : Is the window zoomed right now?
document (document, r/o) : The document whose contents are displayed in the window.
responds to
close, print, save.

--- update - thanks to sylumer I tried So I tried same general thing using Codeium - tried over and over but so far did not get working AppleScript?

I tried a prompt like:

MacOS Ventura - apple mail version 16 and view “use column layout”. Using AppleScript , can you give me a list of the column names in current front most window?

below still has errors - but what i have so far

tell application "Mail"
    set theWindow to front window
    set theColumnNames to {}
    repeat with theColumn in mail columns of theWindow
        set theColumnName to name of theColumn
        if theColumnName is not "" then
            set end of theColumnNames to theColumnName
        end if
    end repeat
    return theColumnNames
end tell

Thanks Dave

AFAIK, you can't manipulate column widths directly. What you can do, as mentioned in the thread I linked to, is use AS to get the position of the column divider then use that in KM for the click-drag start coordinate. Whether that is any easier than using KM's "Image Detect" is another matter!

What are you actually trying to do in Mail?

This demo snippet might get you started if you want to go the image detection route:

1 Like

Thanks much Nige_S.