sorting of finder windoow column not working

hello,
I have a script that opens a window in list view and I want it to sort the modification date to most recent.
For some reason, it is not.
Can someone please tell me what I am doing wrong?
thanks!!
babs

tell application “Finder”
open folder “2010” of the folder “Mechanicals” of the folder “Outdoor” of disk “Marketing”
tell the front Finder window
set the current view to list view
end tell
tell list view options of the front Finder window
set text size to 11
set uses relative dates to false

	tell column modification date column
		set properties to {sort direction:normal}
	end tell
	
end tell

end tell

Hi,

I’m just having a déjà vu :wink:


tell application "Finder"
	open folder "2010" of the folder "Mechanicals" of the folder "Outdoor" of disk "Marketing"
	tell front Finder window to set the current view to list view
	tell list view options of front Finder window
		set text size to 11
		set uses relative dates to false
		set sort column to column modification date column
		set sort direction of sort column to normal
	end tell
end tell

I know I know…Stefan!!!
forgive me…
I looked back at your old post and figured it out!!!
But forgot to delete the post…
In the meantime
I came up with this: below.

worked fine…but yours is cleaner…

The other thing I wanted to do was make every column the same width.
Is there a way to tell every column to be 200 pixes, or do I need to target each column individually?


tell application "Finder"
	open folder "2010" of the folder "Mechanicals" of the folder "Outdoor" of disk "Marketing"
	tell the front Finder window
		set the current view to list view
	end tell
	tell list view options of the front Finder window
		set properties to {calculates folder sizes:false, shows icon preview:false, text size:12, uses relative dates:false, sort column:modification date column}
		tell sort column
			set width to 200
			set sort direction to reversed
		end tell
	end tell
	
end tell

You need to target each column individually


tell application "Finder"
	tell list view options of Finder window 1
		repeat with oneColumn in (get columns)
			set width of oneColumn to 200
		end repeat
	end tell
end tell

Hi Stefen,

OK-here is my script: but I get an error message-see below

tell application "Finder"
	open folder "2010" of the folder "Mechanicals" of the folder "Outdoor" of disk "Marketing"
	tell the front Finder window
		set the current view to list view
	end tell
	tell list view options of the front Finder window
		tell list view options of Finder window 1
			repeat with oneColumn in (get columns)
				set width of oneColumn to 200
			end repeat
		end tell
		set properties to {calculates folder sizes:false, shows icon preview:false, text size:12, uses relative dates:false, sort column:modification date column}
		tell sort column
			set width to 200
			set sort direction to reversed
		end tell
	end tell
	
end tell


here is the message

In thus line of code:
repeat with oneColumn in (get columns)

the error is:
Finder got an error:Can’t get every column of list view options of Finder window 1 of list view options of Finder window 1

any thoughts :wink:
thanks!

the tell list view options block is twice.
Delete the inner one

hi !!
I took that line out and one of the end tells as well as the 200 Width for the original date modified column, now that they are all 200. However, the sort line now gets stuck. It will no longer sort by date modified.
I tried moving that line a few places within the script but still no go…

set sort direction to reversed

any thoughts :wink:
babs

I GOT IT!!!
Found the Right place to put it:lol:
thanks!!!
babs

tell application "Finder"
	open folder "2010" of the folder "Mechanicals" of the folder "Outdoor" of disk "Marketing"
	tell the front Finder window
		set the current view to list view
	end tell
	tell list view options of the front Finder window
		repeat with oneColumn in (get columns)
			set width of oneColumn to 200
		end repeat
		set properties to {calculates folder sizes:false, shows icon preview:false, text size:12, uses relative dates:false, sort column:modification date column}
		tell sort column
			set width to 200
			set sort direction to reversed
		end tell
	end tell
	
end tell




I guess you’ve deleted the wrong tell list view options block.
This should do it


tell application "Finder"
	open folder "2010" of the folder "Mechanicals" of the folder "Outdoor" of disk "Marketing"
	tell front Finder window to set the current view to list view
	tell list view options of front Finder window
		repeat with oneColumn in (get columns)
			set width of oneColumn to 200
		end repeat
		set text size to 11
		set uses relative dates to false
		set sort column to column modification date column
		set sort direction of sort column to reversed
	end tell
end tell

OOOOOhhh.
I like that one even better :lol:

I got rid of the correct list line, but I had to move the sort info after the repeat block, then it worked.
But again, your is much cleaner and easier for me to understand.

As always thanks!!!