with timeout & scripting addition commands

Howdy scripters,

I’m running into a sporadic issue where manipulating files on an iDisk will timeout. So my initial idea was simply to enclose the statements in a timeout block, but this doesn’t work because of the functionality of timeout.

Any ideas? Im basically doing something along the lines of this code.

repeat with aFile in theFiles
	try
		close access file_ref
	end try
	set file_ref to (open for access aFile with write permission)
	set file_contents to read file_ref as «class utf8»
	--call a search and replace routine
	set eof file_ref to 0
	write new_contents to file_ref as «class utf8»
	close access file_ref
end repeat

Thanks!

Hi James,

the iDisk (with WebDAV connection) is a weird thing :wink:
I wrote a routine to upload certain files to the iDisk, and the Finder timed out sometimes (unfortunately not repeatable), but the shell works reliably

Is it possible, to load the file(s), manipulate them locally and copy them afterward back to iDisk?

To apply AppleScript’s timeout behavior to lines which don’t send Apple Events, you can wrap the code in a System Events or Finder tell block

Hey Stefan, yeah the local copy/manipulate/move is going to end up being the route I take, but due to my own stubbornness I was trying to avoid it.

Stefan : Few questions. Im curious why the shell seemed to work and the Finder failed when you can, as you said, apply the timeout to the Finder tell block and it’s associated commands.

May I take a look at the relevant portion of your routine?