• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: <no subject> status loops [longish]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: <no subject> status loops [longish]


  • Subject: Re: <no subject> status loops [longish]
  • From: Nick Quinn <email@hidden>
  • Date: Wed, 11 Apr 2001 08:20:52 +1000

on 11/4/01 3:33 AM, Brian Loomis <email@hidden> wrote:

> I also want an application to return something to me to let me know when it
> is finished, ie filemaker is running a script and I want to check the status
> in an if loop to see if its done

see <http://www.AppleScriptSourcebook.com/tips/gotchas/hurryupandwait.html>
and <http://www.AppleScriptSourcebook.com/tips/gotchas/timeout.html> by Bill
Cheeseman are really good stuff on the dangers of looping to check

> The applescript language guide talks about application responses, but
> doesn't list them or what they do.

Timbuktu example scripts include the following snippet:

tell application "Timbuktu Pro"

-- snipped code

set theStatus to ""
try
set theStatus to (transfer remoteItem to theDestDir with replacing)
on error errorMessage
set ErrorsOccurred to true
end try

repeat while exists theStatus
try
if (transfer status of theStatus is finished with errors) then
set ErrorsOccurred to true
close theStatus
exit repeat
end if
on error
-- assume the window went away before the IF was evaluated,
-- this happens sometimes
exit repeat
end try
end repeat

-- more snipped code

end tell

I don't think the repeat loop here is a "hard" loop as the "if" after the
second "try" is done by Timbuktu when it has the time.

I have not tried this technique on FM having found that the following
un-elegant shot-gun approached worked:

if not ErrorsOccurred then
tell application "FileMaker Pro"
open file "hd:acc cust"
try
considering application responses
-- with timeout of 600 seconds -- (1)
do script "export cust"
-- end timeout
end considering
on error errorMessage
set ErrorsOccurred to true
end try
if not ErrorsOccurred then
with timeout of 600 seconds -- (2)
open file "hd:acc cust sum"
end timeout
try
considering application responses
do script "export cust month"
end considering
on error errorMessage
set ErrorsOccurred to true
end try

etc...

The timeout (2) was necessary because control is return immediately after
the "do script..." above and the "open file "hd:acc cust sum"" timed out
(because FM did not return control until it completed the script and started
the "open").

I hope this helps,

Nick Quinn
Sunshine Beach Software in OZ


References: 
 ><no subject> (From: Brian Loomis <email@hidden>)

  • Prev by Date: Re: «event XUVJdtdl» Error
  • Next by Date: Re: <no subject>
  • Previous by thread: Re: <no subject>
  • Next by thread: Re: <no subject>
  • Index(es):
    • Date
    • Thread