Putting a delay on a folder action

Hello,
OK, I have this folder action that I am using to call an action in photoshop. Problem is, these files are so big, that the action starts before the file gets copied or saved into the folder, causing it to give the damaged or truncated message.
Is there a way of doing the following 2 things:

1-put a delay so that the action doesn’t start until a specified time, like 1 minute
2-moving that file to another folder so it doesn’t keep repeating the action.

Here is what I have so far: thanks

on adding folder items to this_folder after receiving these_items
	repeat with an_item in these_items
		tell application "Adobe Photoshop CS3"
			activate
			open an_item
			do action "BoxShot" from "babs"
		end tell
	end repeat
end adding folder items to

babs

Hello again,

OK…i tried to just add this line delay 50, but every time I drag an image into the folder with the script, it says the image has been truncated or corrupted…if I take the folder action off and just drag the same image into that folder it is fine…??? any thoughts would be greatly appreciated.

on adding folder items to this_folder after receiving these_items
	repeat with an_item in these_items
		tell application "Adobe Photoshop CS3"
			activate
			
			open an_item
			delay 50
			do action "BoxShot" from "babs"
		end tell
	end repeat
end adding folder items to

thanks!!
babs

The standard technique to overcome the “Folder Actions run before the file is fully copied/uploaded/etc.” problem is to check each file’s size and wait for it to stop changing (growing). There are many posts here with examples, this one by Adam Bell is fairly straight forward (it checks the total size of all the items in the folder, but it looks like the handler could be used on individual files, too).

hello,
Thanks…I see what you are saying.
I will look at that post and see what I come up with.
thanks again
babs

this is the solution I came up with: this_folder being the folder the Folder Action is being run on, obviously

--this tidbit of coding from John C. Welch via Apple Mailing lists site
	tell application "Finder" to set theFolderName to name of this_folder
	repeat with x in added_items
		set theFileInfo to info for x --get info for the downloading file(s)
		set theBaseSize to size of theFileInfo --get initial size
		delay 3 --wait 3 seconds
		set theFileInfo to info for x --get info again
		set theCompareSize to size of theFileInfo --get a newer size
		repeat while theCompareSize ≠ theBaseSize --if they don't equal, loop until they do
			set theBaseSize to theCompareSize --new base size
			delay 3 --wait three seconds
			set theFileInfo to info for x --get info
			set theCompareSize to size of theFileInfo --get a newer size
		end repeat
	end repeat

Hope that helps!
Michael