Sort Finder and adjust columns in Sequoia

Years ago I found this script that has worked fine in the latest versions of MacOs, but in Sequoia it no longer works.

It sorts Finder items by name and adjusts the size of the columns.

I would appreciate help in making the necessary corrections to get it to work correctly on MacOS 15.0.1.

tell application "Finder"
	activate
end tell

tell application "Finder"
	activate
	tell list view options of the front Finder window 
		
		set properties to {calculates folder sizes:false, shows icon preview:false, icon size:small icon, text size:12, uses relative dates:true, sort column:name column}
		
		tell column name column
			set properties to {index:1, sort direction:normal, width:280}
		end tell
		
		tell column size column
			set properties to {index:2, sort direction:normal, width:72, visible:true}
		end tell
		
		tell column modification date column
			set properties to {index:3, sort direction:normal, width:120, visible:true}
		end tell
		
		tell column creation date column
			set properties to {index:4, sort direction:normal, width:120, visible:true}
		end tell
		
		tell column kind column
			set properties to {index:5, sort direction:normal, width:120, visible:true}
		end tell
		
		tell column label column
			set properties to {index:6, sort direction:normal, width:72, visible:false}
		end tell
		
		tell column version column
			set properties to {index:7, sort direction:normal, width:72, visible:false}
		end tell
		
		tell column comment column
			set properties to {index:8, sort direction:normal, width:240, visible:false}
		end tell
		
		set sort column to size column
		
		
	end tell
	
	tell the front Finder window
		set current view to list view
		set zoomed to false
	end tell
	
end tell

``
1 Like

Without knowing a clear reason, the script is working perfectly again.

DJUNQUERA. Your script does not work on my Sequoia computer. The following does work FWIW.

tell application "Finder"
	activate
	tell list view options of the front Finder window
		set properties to {calculates folder sizes:false, shows icon preview:false, icon size:small icon, text size:12, sort column:name column, uses relative dates:true}
		
		tell column name column
			set properties to {index:1, sort direction:normal, width:280}
		end tell
		
		tell column size column
			set properties to {index:2, sort direction:normal, width:72, visible:true}
		end tell
		
		tell column modification date column
			set properties to {index:3, sort direction:normal, width:120, visible:true}
		end tell
		
		tell column creation date column
			set properties to {index:4, sort direction:normal, width:120, visible:true}
		end tell
		
		tell column kind column
			set properties to {index:5, sort direction:normal, width:120, visible:true}
		end tell
		
		tell column label column
			set properties to {index:6, sort direction:normal, width:72, visible:false}
		end tell
		
		tell column version column
			set properties to {index:7, sort direction:normal, width:72, visible:false}
		end tell
		
		tell column comment column
			set properties to {index:8, sort direction:normal, width:240, visible:false}
		end tell
		
		--set sort column to size column --conflicts with setting in list view options
	end tell
	
	tell Finder window 1
		set current view to list view
		--set zoomed to false --breaks the script
		set currentFolder to target
		set target to path to public folder
		try
			set target to currentFolder
		on error
			openComputerContainer() of me
		end try
	end tell
end tell

on openComputerContainer()
	tell application "System Events" to tell process "Finder"
		click menu item "Computer" of menu "Go" of menu bar 1
	end tell
end openComputerContainer

peavine. First of all thank you for your interest in helping me.
Your code on my machine has an erratic behavior, sometimes it works and sometimes it doesn’t work.
I have been testing it with different Finder situations (sort column, normal or reverse sort…) and I have not been able to transmit you anything to guide you.
Regards.

DJUNQUERA. I retested my script on multiple folders, and it worked as expected with one exception. The visible property no longer works in my testing. For example:

--manually refresh Finder window after running this script

tell application "Finder"
	activate
	delay 0.5 --probably not necessary
	tell list view options of Finder window 1
		set properties of column kind column to {width:400} --this works
		--set properties of column kind column to {visible:false} --this doesn't work
		--set properties of column kind column to {visible:true} --this doesn't work
		--set properties of column modification date column to {visible:false} --this doesn't work
	end tell
end tell

These characters at the bottom of the posted script throw my attempt to execute it off
``

delete the offending characters.