Switching sort column in Finder list view

Why doesn’t this script work to make a Finder list view switch to sorting on the name colun:

tell application "Finder"
	set sorter to (sort column of list view options of the front window)
	
	set byname to first item of (get columns of list view options of the front window whose name is size column)
	set sorter to byname
        -- toggle view options to try to get window to update
	set current view of the front window to icon view
	set current view of the front window to list view
end tell

The script runs fine, but it seems to do absolutely nothing to the finder view sort column. Why is Finder playing dumb?

Also does anyone know how to put shortcut keys easily on scripts for the Finder? It can be done easily in the Mail scripts by adding something like ___cmd-opt-L to the end of s cript name that’s in the ~/Library/Scripts/Mail Scripts folder, to give it the shortcut key of CMD-OPT L. But finder doesn’t seem to have it’s own script menu like Mail (and iTunes), and adding these extensions to the scripts in the standard script menu does nothing.

Thanks

Hi,

There are sweveral errors in the Finder dictionary under ‘list view options’. Under ‘sort column’, it says that it wants a ‘column’ for setting, but it just wants a column name. However, ‘sort column’ returns a column reference for setting properties of a column. Just do something like this:

tell application “Finder”
activate
set sort column of list view options of front window to size column
end tell

You need to experiment when you hit snags.

gl,