Waiting for process to finish

This must be basic but I am having trouble.
I need the finder to complete a process before it shows a dialog
with timeout does not seem to work

tell app “finder”
empty trash
end tell

display dialog “Congrats. No trash”

I get the trash progress bar still emptying trash while the dialog is being displayed.
Thanks in advance

Try this, weedinner:

tell application "Finder" to empty trash
repeat while (info for (path to trash))'s size > 0
	delay 0.2
end repeat
display dialog "Congrats. No trash"

Sorry Kai

This doesn’t work. Tried it with timeout and still no joy.

Hmm… very strange. Works perfectly here (Mac OS 10.4.2) as written. What system are you on, weedinner?

Kai

10.3.9

Try filling your trash with 100mb of files forcing the progress bar to work for a second or two. The “Congrats” dialog appears active before the progress bar disappears.

What I am trying for here is a fix all for a problem I have for a number of scripts. That a process is completed before the script excutes the next one. That process could include any application doing something ie fetch uploading files, filemake checking records etc.

Thanks for your time Kai

Model: 2 G5’s 2imacs, 1.5 powerbook, G4 a G3Blue and white a 8200…
AppleScript: 1.9.3
Browser: Safari 312
Operating System: Mac OS X (10.4)

I can assure you that I did try that weedinner - and more. In fact, I created enough dummy files to make the progress bar chug along for anthing between 30 seconds and several minutes at a time. In every case, the script works exactly as I’d expect - it waits until the progress bar is dismissed before throwing up the final dialog. Since (as I think I mentioned earlier) I’m testing in Mac OS 10.4.2, I can only imagine that this is a version issue. :rolleyes:

I can appreciate the problem. Unfortunately, since I can’t replicate it here, it’s kinda difficult to come up with a solution…

Hope you find an answer soon. :slight_smile: