Re: help needed to abort a script
Re: help needed to abort a script
- Subject: Re: help needed to abort a script
- From: email@hidden
- Date: Wed, 17 Jan 2001 00:43:34 -0500
On Tue, 16 Jan 2001 18:02:05 -0800, Ken Victor <email@hidden> asked,
[working script deleted.]
>
basically, i have this working. the problem i'm having is in aborting
>
the process if i realize that it should be aborted.
>
>
i have a separate non stay open application that looks like:
>
>
tell application "MyStayOpenApp" to SetUserAborted()
>
>
my understanding says that if i double click this aborter at the
>
finder it should then send an apple event to my stay open app and my
>
stay open app should receive this message and act upon it and then
>
resume whatever it was doing.
Here's an area where the AppleScript Language Guide, my past experience, and a
test I just ran all disagree.
The book says one message can interrupt another. But I tried the example in the
ASLG, and it wouldn't interrupt. I also tried a script with multiple handlers
and delay statements, and could never get one handler to run until the previous
one finished.
But my recollection was that AppleScripts aren't fully reentrant but don't fully
exclude reentrancy. I recalled that I could get a script to handle one message
while it was processing another, but I couldn't get it to handle a third. Maybe
that was in AppleScript 1.1.3, and now in 1.3.7 the applet shell enforces "one
at a time" handling of events.
But under 1.3.7, I can't get a message into a script until the called handler
has returned, and the script is idle. That means you'll have to rethink your
approach. Probably you can have a shared resource that one script sets and the
other checks. Probably a third script application, containing just a property.
property UserAborted : false
Then you can use,
tell application "Shared Flag" to set UserAborted to false
and check in you plugin loader,
if UserAborted of application "Shared Flag" then
If you are using Scripter, you could store this value in ScriptBase. You might
look at Akua Sweets "universal" command which also implements a global shared
variable across scripts. (Where does Akua Sweets keep this information? It is
a classic osax, so it might be purged from memory.)
Any of these methods should be quick than using a file as a flag.
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden