@Malcolm: I have tried your advice, too. But filemaker or the finder
didn't open the file.
Then the Loop from your routine starts, but the time runs out without
opening the file. After this my seconds script starts and produce the
error.
Good , then the script works. All you need to do is open the file.
I've never needed WaitUntilWindowExists to return a result because
that's what I use WindowExists for. However, I've modified it. If it
times out it returns the result of windowExists. You can use that as a
test.
to WaitUntilWindowExists(win, n)
-- windows may take a while to populate, so we should wait for them,
giving up after N seconds
set winExists to false
repeat n times
if my WindowExists(win) then return delay 1 -- enforce a delay
delay 1
end repeat
return WindowExists(win)
end WaitUntilWindowExists
to WindowExists(win)
-- is the window there?
tell application "Filemaker Pro"
return name of every window contains win
end tell
end WindowExists