how to attach script?

how do i write a script that i can attach to a folder, and the script tell the finder that when a folder (from within the folder with the attach script) is opened, resize and change position to a specific size and position written in the script? thanx, jmarsh

First, write the script. Eg:

on opening folder thisfolder
	tell application "Finder" to set bounds of window of thisfolder to {50, 100, 200, 300}
end opening folder

Second, attach your script to every folder you wish to be resized-positioned. If you don’t know how, take a look to Apple’s sample scripts here:
http://www.apple.com/applescript/script_menu/
(look for “Folder Actions Control Scripts” in this page)

jj, thanx for the reply. if i use your code with no changes it works great, but when i go to add my coordinates it gives me error message when running script. here is what i am trying to accomplish:

on opening folder thisfolder
tell application “Finder”
activate window of thisfolder
set size of window of thisfolder to {255, 500}
set position of window of thisfolder to {390, 365}
set view of window of thisfolder to name
set view of window of thisfolder to label
end opening folder

i am in OS 9 and don’t know if that is an issue. also, do you have to attach it to every folder you want to have the script run on? i thought you could attach a script to one folder and every folder within that folder could be controlled with the right code?

Oooops! I allways forgot when I’m in X or OS forum.
In fact, I can’t test a MacOS environment anymore, but if my code worked, this may also work:

on opening folder thisfolder 
   tell application "Finder"
      tell window of thisfolder
         set size to {255, 500}
         set position to {390, 365}
      end
   end 
end opening folder

In OSX there is not a “size” property, and I can’t remember if it was one in OS 9. If this still doesn’t work, just use the first code, BOUNDS, instead. To guess the bounds of a particular window, you can simply place manually the folder in the Finder, then run this code:

tell application "Finder" to bounds of window 1

And yes, you attach 1 action to 1 folder, which affects only to the related folder. If not, the syntax for your proposal would be anything such as:

on opening folder x contained by folder y

Which is not possible (at least today!)

Cheers…

jj