Hi,
I’m still in the process of learning Applescript, so apologies if this is an obvious question. I tried searching existing topics for an answer, but didn’t come up with one.
I’m trying to wait for an application’s dialog to appear before I perform certain actions to it, such as pressing a button or something. But, I don’t want to use a simple “delay 20” statement. I tried several variations of the following. It works great if the dialog does eventually appear. But if it doesn’t, the script just runs forever in an infinite loop. I’d like to be able to exit out of the loop after some number of seconds, but I can’t figure out how. Help!
with timeout of 20 seconds
try
repeat until exists (window "blah" of application "thingy")
delay 1
end repeat
on error
return "this sucks"
end try
end timeout
tell window "blah" of application "thingy"
click button "OK"
end tell