Re: when quit is not quit
Re: when quit is not quit
- Subject: Re: when quit is not quit
- From: "Donald S. Hall" <email@hidden>
- Date: Sun, 04 Nov 2001 22:47:05 -0700
I have ended up using a return statement. Fortunately, the structure of my
script is such that I can put in a return as in the example below and avoid
any unwanted actions:
try
-- possibly error throwing statements here
on error errMsg number errNum
handleError(errMsg, errNum) -- a simple handler that ends with 'quit'
return -- returns to the last line of my run handler
end try
Don
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
email@hidden
>
From: Jon Pugh <email@hidden>
>
Date: Sun, 4 Nov 2001 08:05:40 -0800
>
To: "Donald S. Hall" <email@hidden>,
>
<email@hidden>
>
Subject: Re: when quit is not quit
>
>
At 10:26 PM -0700 11/3/2001, Donald S. Hall wrote:
>
> I am not sure what "the next time AppleScript returns" means exactly. Is
>
> there anyway to force this to happen?
>
>
Yes, throw an error.
>
>
For example:
>
>
quit
>
error number -128 -- user cancelled
>
>
This will cause everything after the error statement to be skipped, although
>
execution will pass to whatever active error handler exists.
>
>
There is no way to make quit not return. You need to make the flow of control
>
after the quit get you to a return statement or the end of a handler block.
>
>
Another possibility is:
>
>
quit
>
return
>
>
But this doesn't work for nested handlers (i.e. a handler which calls another
>
handler) since you only return from the current handler.
>
>
Jon