Script is timing out, can I echo "do shell script"

Is there a default output window for AppleScript that I can use? I’m working on a script that automomatically updates a zip archive with all the images in a database. There are images added daily, so it simply updates with the newest images. Here’s the code for reference:


tell application "Finder"
	try  -- Make sure the Art Database folder is in its default location
		if (not (exists (folder "Art Database" of desktop))) then
			set srcFolder to (quoted form of POSIX path of (choose folder with prompt "Please locate the Art Database folder on this computer:"))
		else
			set srcFolder to "~/Desktop/Art\ Database/"
		end if
		
		display dialog "Click ok to begin archiving the Image Database.  This may take several minutes..."
		
		-- Mount the art server
		if (not (exists (disk "Art Server"))) then
			mount volume "afp://admin:@10.30.2.55/Art Server/"
		end if
		
		-- Update the image archive
		do shell script "zip -ru1 /Volumes/Art\ Server/Art\ Database/backup/artDBimages.zip " & srcFolder & "images/"
		
		display dialog "All done."
		
	on error err
		display dialog err
	end try
end tell

Here’s the problem. There are 600+ high-resolution photos (with more added daily as the semester progresses), so even with “quick archiving” enabled, it still takes a considerable amount of time for it to check for changes and re-archive the zip file. That’s when AppleScript gets a finder error, and tells me it timed out (if I let it run without clicking OK, it’ll finish updating the archive).

I know you can physically load Terminal and tell it to run the same script, but I would prefer that this be done seemlessly in the background. If that’s unavoidable, how would I modify the script to not finish until Terminal is done doing what it’s doing (updating the zip archive)?

Mucho Thanxo,
-Rob

Your script timeouts because the long part (the “do shell script” call) is inside a tell block. You can enclose it inside a “with timeout of 3600 seconds”/“end timeout” clause or, better, move it out of the tell block, since the Finder is not needed for this task. Eg:

try
	set srcFolder to quoted form of POSIX path of (((path to desktop as text) & "Art Database") as alias)
on error --> dir is not at desktop
	set srcFolder to quoted form of POSIX path of (choose folder with prompt "blah")
end try

try
	"Art Server:" as alias
on error --> mount disk
	--> blah
end try

--> update
do shell script "blah"

Kudos.

Tanks,
-Rob