Changing window view to list

I need script to change the view of a window to list. Everytime I open a folder from our server the first thing I do is change the view. I would like this script to open on start-up (which I can do by adding it to my start-up script) and stay open. I tried:

tell application "Finder"
activate
set view of container window of folder selected to name 
end tell

but this was far to simple.
Any suggestions? Thank you,
Steven.

A slightly shorter version is:

tell application "Finder"
	set view of window 1 to name
end tell

–tet

This is a drag-and-drop applet that opens a folder and sets its view to list by name:

on open (itemList) 
tell application "Finder" 
set theFldr to item 1 of the itemList 
open theFldr 
set view of theFldr to name 
end tell 
end open

I tried this and it blew up because I didn’t have a window open. Here’s another version, set up as a stay-open app with an idle handler so it won’t eat up all the system resources. It looks at the front window every 3 seconds and sets its view to name.

on idle 
tell application "Finder" 
try 
set view of window 1 to name 
end try 
end tell 
return 3 
end idle

i use the OSA menu to launch this script with a key command.

tell application "Finder"
set view of (every window whose index is 1) to name
end tell

Oops. I had a pop-up window open that I forgot about. Once I closed that everything failed properly.
–tet