Waiting for an application to close

Hi,

AppleScript novice here with a question I thought would be rather straightforward, but I cannot find the answer. I’m writing a script that will allow me to sync my Palm device with both Entourage and Palm Desktop, and it involves moving around some conduit files, initiating a HotSync, then moving some more conduit files around, and running a HotSync a second time. What needs to happen is, the script has to wait until the HotSync has completed before moving on.

The HotSync application automatically closes once it’s completed, so i just have to figure out how to say “wait until application closes” or something similar. But maybe it’s not that simple…

Thanks for your help,
Mike

Hi Mike,
would something like this do it?

tell application "Finder"
	repeat until name of processes does not contain "yourAppNameHere"
		delay 5
	end repeat
end tell

Thanks,
Nik

HI,

You can try the “with timeout” command and give it enough time to complete before the script moves on.

Or, there is another more appropriate command “ignoring application responses” or “considering application responses” but I forgot which one would apply to yours. One of these two commands allow your script to wait to finish before it moves on but I forgot which one would to the job for you. Time to experiment, huh?

Good luck.

archseed :slight_smile: