Updating incoming file info in a dialog box

I’m new to applescript and have been asked to use it to track the status of files being sent to a Mac (OS X Tiger). The problem I have is in locating when a file has completely arrived when sent via FTP. I have tried to do this by using a folder script attached to the folder where the files arrive which successfully checks for name clashes and then executes a repeat loop to check on the size of the incoming files. Unfortunately I have not been able to find a successful method of updating the information retrieved by the repeat loop.

Why does the following always retreive the same values on the incoming file, or the alias of the file or the info of the file. I have tried the ‘busy status’ and 'update 'calls to no avail. I have no experience of Mac shell script whatsoever and scouring the web has drawn a complete blank.

				repeat while file_check_counter is less than 10
					tell application "Finder"
						set data_doc_size to the data size of the this_item
						set physical_doc_size to the (((physical size of the this_item) / 1024) / 1024)
						set logical_doc_size to (((the size of the this_item) / 1024) / 1024)
					end tell
					set the file_check_counter to the file_check_counter + 1
					display dialog "Data Size is " & data_doc_size & "." & return & ¬
						"Physical Size is " & physical_doc_size & "." & return & ¬
						"Logical Size is " & logical_doc_size & return & return & ¬
						"File check counter is " & file_check_counter & "." buttons {"Cancel"} default button 1 giving up after 10
				end repeat

Can anyone please help??

Hi Jaques,

The code you put up here looks an awful lot like the original code I wrote for this particular task. But not exactly! I think the reason mine wouldn’t work was due to some minor syntactical errors (I have managed to emulate my mistakes) compounded by that most obvious of programming errors - trying to do too much at once on unfamiliar ground.

Here’s the code I finally used just in case anyone has similar problems in the future …

on adding folder items to this_folder after receiving these_items
		repeat with i from 1 to number of items in these_items
			set this_item to item i of these_items
				set The_size to size of (info for this_item)
				set display_The_size to ((The_size / 1024) / 1024)
				display dialog "Current file size is " & display_The_size & "Mb" buttons {"Cancel"} default button 1 giving up after 3
				delay 3
				if size of (info for this_item) = The_size then exit repeat -- the file is fully downloaded
			end repeat
			display dialog "Everything is now cool so proceed" buttons {"Cancel"} default button 1 giving up after 3
		end repeat
	end try
end adding folder items to

Thankyou … thankyou and thankyou again. You saved my skin bigtime!

ps Is it possible to ftp drinks on this thing? ;o]