Has Application fully loaded

Hi all,

Does any body know of a way to check if an application has completed loading (activating)?

I’m opening Mail through a standard tell activate block, but because I’m using UI scripting I need the application to be completely loaded before my script progresses. Nine times out of ten everything will be fine, but if the app takes especially long to load (like from a cold startup) then things get messy.

Thanks,
James

Hi James,

maybe you could simply test for the existance of the UI element you’re about to script? Sth like:

tell application "System Events"
	tell process "Mail"
		tell window 1
			repeat until (exists (button 1))
				delay 0.5
			end repeat
			tell button 1
				...
			end tell
		end tell
	end tell
end tell

Hope it helps …

D.

Simple but effective! Worked a treat, thank you.

James.