On 17 Aug 2005, at 20:30, Christopher Nebel wrote:
On Aug 17, 2005, at 7:41 AM, Daniel Jalkut wrote:
As I understand it, the way to avoid the screeching halt is to
install callback methods on OSA such that you get time to "feed
your app" even while the script is running. I believe this is
what application's like Script Editor do to maintain a responsive
user interface while running.
One problem is that there doesn't seem to be a "one-stop shop" for
getting time while a script is executing. There is the "action
proc" which only gets called back while the script is literally
running (its commands are being interpreted - not waiting for
another applications to respond). Then there is the "AEIdle
callback" which gets called at certain, difficult to predict (for
Adding to the confusion, you have to register callbacks for these
two mechanisms in a completely different way (one is a simple
callback on the scripting component, the other (the idle) you have
to intercept all AppleEvent sends and tack your own idle proc onto
I hope I've drastically misunderstood things and there is a much
simpler way to go about this. Unfortunately, I haven't heard
anything yet. Often the workaround that gets suggested is simply
to fork a separate process to handle the script. Multi-threading
at its guaranteed best! I've resisted this so far but who knows ...
It would be great if somebody more knowledgeable than me had some
wisdom to share about the "best way" to accomplish main-thread
responsiveness while executing a script.
No, you've got it basically correct. AppleScript is not thread-
safe; running it on a secondary pre-emptive thread will lead to
suffering. The only solutions currently are to run it on the main
thread and use the callbacks, use cooperative threads, or fork
another process to run the script.
So I can't run it on a secondary thread even if I'm not doing
anything applescripty in the main thread? That's what I'm doing
here, and it seems to be working ok...but if you think it's going to
cause problems in certain situations, I'll take your word for it and
go & try figure out those callbacks...
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: