Re: Apple Event timed out message
Re: Apple Event timed out message
- Subject: Re: Apple Event timed out message
- From: Emmanuel <email@hidden>
- Date: Thu, 16 Aug 2001 10:24:31 +0200
At 22:50 +0200 15/08/01, Mario Kolaszewski wrote:
>
>
While using 'Download Files to Server' script
>
I am getting the following message "Apple Event Timed Out"
>
However the script continues undisturbed.
>
Can anyone share some light on this subject?
When you script "tells" an app to do something, it is supposed to wait for
the returned value. Example. Suppose you script includes the following
block.
-------------------------
tell application "SurfWriter"
ProcessWaves
end tell
-------------------------
The script will send to the "SurfWriter" app the command "ProcessWaves",
and will halt until "SurfWriter" finishes processing the command and
(usually) returns a result.
Except that there is a timeout (default: 1 minute): if after 1 minute the
app has not yet returned, then AppleScript triggers a timeout error, and
the script exits the "ProcessWaves" line, under an error condition. While
the app, undisturbed as you noted (actually, undisturbable), continues
processing the command, possibly for ever.
The timeout error can be caught by a "try ..." wrapper.
The default timeout value (1 minute) can be changed to a more suitable one
by a "with timeout ... " wrapper.
For instance, you could test if an app is busy by running the following block:
------------------------- untested
try
with timeout of 2 seconds
tell application "SurfWriter"
get 1+1
end tell
end timeout
set isBusy to false
on error
-- being not able to compute 1+1 in 2 seconds certainly means being busy
set isBusy to true
end
-------------------------
HTH
Emmanuel