Monday, December 11, 2017

#1 2005-10-13 02:39:40 pm

julifos
Administrator
From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

What is "AppleEvent timed out"?

This is an apple event error, which means that you are not allowed to execute more code because you are very slow.

For example, you are targeting the Finder to duplicate a folder, which has a size of 888 terabytes. After it is duplicated, you wish rename the new folder to "duplicate gotta hey!". This is the code:

Applescript:

tell application "Finder"
   duplicate alias "path:to:really BIG folder:"
   set name of result to "duplicate gotta hey!"
end tell

The Finder will receive the order: "duplicate!" And AppleScript will wait for a response: "done, sir!".

If AppleScript gets tired of waiting for an answer, it will time out and will die throwing the error "AppleEvent timed out". So, the "set name..." line won't be executed.

Actually, AS 1.9.1, AppleScript gets tired after 2 minutes. However, you can prevent this from happening using the following statement:

Applescript:

with timeout of (30 * 60) seconds
   tell application "Finder"
       duplicate alias "path:to:really BIG folder:"
       set name of result to "duplicate gotta hey!"
   end tell
end timeout

Now, AppleScript will get tired after 30 minutes!

Note that this error will happen only when you are targeting a process (eg, the Finder). However, if you use the following code...

Applescript:

set aFolder to (choose folder with prompt "Choose a folder, please...")

... If you were an irresolute folk, you could wait for 17 days before choosing a folder, and you wouldn't receive a timeout error.


Filed under: Finder

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)