Re: Help with quitting stay-open app
Re: Help with quitting stay-open app
- Subject: Re: Help with quitting stay-open app
- From: kai <email@hidden>
- Date: Thu, 26 May 2005 11:34:10 +0100
On Thursday, May 26, 2005, at 10:18 am, Emmett Gray wrote:
There's some behavior I don't understand. I have the following script:
[snip: example script]
The issue is that if I cancel the initial action, confirmDropped, I
still see the next dialog in the open handler, but it doesn't ever
get to the idle handler. Why doesn't it just quit when I tell it to?
Of course I can bash my way through to make it quit when I want, but
I'd like to understand what's going on in the program flow.
I saw this first time around, Emmett - and nearly replied then, but got
sidetracked. Sorry.
Seems AS completes the current routine (including statements in calling
handlers) before executing the quit statement, which is not necessarily
the behaviour in other scripting environments. I couldn't remember if
this was the case previously but, on checking back to Mac OS 9.1/9.2,
the behaviour there was just the same. So at least it appears to be
consistent.
I doubt you need any help regarding ways to deal with this, which
basically make sure the quit statement is at/near the end of the queue.
However, here are a few examples anyway:
-----------------
to confirmDropped(newItems)
try
display dialog "Process the dropped item(s)?"
--do something if OK
true
on error number -128 (* user cancelled *)
quit
false
end try
end confirmDropped
on open newItems
if confirmDropped(newItems) then
display dialog "I didn't cancel."
end if
end open
-----------------
to confirmDropped(newItems)
try
display dialog "Process the dropped item(s)?"
--do something if OK
on error number -128 (* user cancelled *)
quit
error number -128
end try
end confirmDropped
on open newItems
confirmDropped(newItems)
display dialog "I didn't cancel."
end open
-----------------
to confirmDropped(newItems)
display dialog "Process the dropped item(s)?"
end confirmDropped
on open newItems
try
confirmDropped(newItems)
display dialog "I didn't cancel."
on error number -128 (* user cancelled *)
quit
end try
end open
-----------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden