Re: spurious timeout on nth Apple event on Snow Leopard
Re: spurious timeout on nth Apple event on Snow Leopard
- Subject: Re: spurious timeout on nth Apple event on Snow Leopard
- From: Matt Neuburg <email@hidden>
- Date: Mon, 09 Nov 2009 10:56:09 -0800
- Thread-topic: spurious timeout on nth Apple event on Snow Leopard
On Sat, 7 Nov 2009 14:46:36 +0100, email@hidden said:
>Though, now I have something ;) When I strip the script a bit and run
>it repeatedly in AppleScript Editor (still eats RAM):
>-----
>set L to ""
>repeat with i from 1 to 300000
> try
> with timeout of 5 seconds
> tell application "TextEdit" to current date
> end timeout
> on error errm number errn
> --display dialog "timeout" & i & " " & errn
> set L to (L & i & return)
> exit repeat
> end try
>end repeat
>L
>-->
>3420
>44115
>131117
>170425
>26227
>104888
>Should be always 65536, or a few counts under.
No, because you don't know what Apple events may have been run in the
meantime. The overall count being maintained by the system is global. So,
when we hit reply ID 65535 and the bug is triggered, that has nothing to do
with what *your* "i" is. If the system happens to be at reply ID 65534 and
you run your script, "i" will be 1, because it takes only one more Apple
event to hit the bug.
Furthermore, your example is deeply flawed, because of the choice of "tell
application "TextEdit" to current date", because that sends (at least) two
Apple events. (You can discover this in Script Debugger's log window.) As
you would learn if you were to look in my book, the mechanism used when an
application is sent a scripting addition command is extraordinarily complex
and roundabout. But Apple events are what we are trying to count. Use my
original, which sends exactly one Apple event, and your results will be more
consistent ("tell application "Finder" to count windows").
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden