It sounds like you may have been reading AppleScript: Beginner's Tutorial.
Since you haven't received any replies yet, I'll try to answer. I'm not very familiar with AppleScript and don't have access to a Mac at this hour. I used to use HyperTalk (in ye olde HyperCard, on System 7) a lot, which AppleScript was based on.
I've tried to account for the possibilities of installing in the Finder window toolbar or dropping one or more files or folders on the script icon.
-- Adopted from a script found on http://snippets.dzone.com/posts/show/1037
-- which in turn was based on a script in the comments of this article:
-- http://www.macosxhints.com/article.php?story=20050924210643297
-- Instructions for use:
-- Paste this script into Script Editor and save as an application to
-- ~/Library/Scripts/Applications/Finder/open in Finder
-- Run via the AppleScript Menu item (http://www.apple.com/applescript/scriptmenu/)
-- Or better yet, Control-click and drag it to the top of a finder window so it appears in every finder window.
-- Activate it by clicking on it or dragging a file or folder onto it.
-- Another nice touch is to give the saved script an icon.
-- To do this, in the Finder, use Get info (Command-I) on both another file and this saved script.
-- (The other file's icon should be the one you want to use on this script.)
-- In the Get Info window of the other file, click the icon (it will highlight blue) and copy it by pressing Comand-C.
-- Then, in the Get Info window of this file click on this script's icon and paste by pressing Command-V.
-- If opened by clicking the toolbar
on run
tell application "Finder"
try
set theCurrentWindow to (folder of front window as string)
useMyViewPreferences(theCurrentWindow)
setContainedFolderViews(theCurrentWindow)
on error errorMessage number errorNumber
showLocalError(errorMessage, errorNumber, "setting the view of the front window")
end try
end tell
end run
-- If dropping a file or folder on the icon
on open (droppedItems)
tell application "Finder"
try
repeat with itemPath in droppedItems
set itemPath to itemPath as string
if not (itemPath ends with ":") then
set x to the offset of ":" in (the reverse of every character of itemPath) as string
set itemPath to (characters 1 thru -(x) of itemPath) as string
end if
useMyViewPreferences(itemPath)
setContainedFolderViews(itemPath)
end repeat
on error errorMessage number errorNumber
showLocalError(errorMessage, errorNumber, "working with the file or files you supplied")
end try
end tell
end open
-- starting with the topmost folder (current window, or dropped on the icon)
on setContainedFolderViews(parentFolder)
try
repeat with eachFolder in (get every folder of parentFolder)
useMyViewPreferences(eachFolder)
end repeat
on error errorMessage nummber errorNumber
showLocalError(errorMessage, errorNumber, "working with the list of folders in the front window")
end try
end setContainedFolderViews
-- Try to set view of selected folder to my preferred view
on useMyViewPreferences(currentFolder)
-- Since this handler is called from inside a loop,
-- the error messages in could potentially get very annoying.
try
set toolbar visible of currentFolder to false
set bounds of currentFolder to {0, 43, 899, 855}
set current view of currentFolder to list view
set visible of column id name column of list view options of currentFolder to true
set sort column of list view options of currentFolder to name column
set visible of column id version column of list view options of currentFolder to false
set visible of column id label column of list view options of currentFolder to false
set width of column id name column of list view options of currentFolder to 300
set width of column id modification date column of list view options of currentFolder to 111
set width of column id creation date column of list view options of currentFolder to 111
set width of column id size column of list view options of currentFolder to 90
set width of column id kind column of list view options of currentFolder to 180
set uses relative dates of the list view options of currentFolder to false
set calculates folder sizes of the list view options of currentFolder to true
on error errorMessage number errorNumber
showLocalError(errorMessage, errorNumber, "setting the view of the current folder")
end try
end useMyViewPreferences
-- Simple-minded error dialog
on showLocalError(errorMessage, errorNumber, doingStuff)
display dialog ¬
"Sorry, an AppleScript error of type " & errorNumber as text & ¬
" (" & errorMessage & ") occured in " & doingStuff & ", because" & ¬
" the programmer tried to use vague memories of HyperTalk to write this script."
end showLocalError
EDIT:
I've assumed the Finder makes it possible to set view attributes without opening each folder. If I were to change this to open each folder, I would probably want to ensure that each window the script opened was closed before the next one opened. I think it would still bog down for large numbers of folders, though.
Perhaps an error-check for deep nests or long lists would be wise, which would then prompt the user for confirmation before starting. Would also be important to include a nice way abort the script, preferably via a cancel button in a progress dialog.