applescript delay until

… for example if I had a script that requires TextEdit to be open, is there a way to say “delay until TextEdit is open”?

Actually AppleScript waits before executing the do TextEdit code until the app has opened

tell application "TextEdit"
	activate
	-- do TextEdit code
end tell