Re: Return command from within a subroutine
Re: Return command from within a subroutine
- Subject: Re: Return command from within a subroutine
- From: kai <email@hidden>
- Date: Sat, 31 Dec 2005 01:38:54 +0000
On 30 Dec 2005, at 17:32, Jay Louvion wrote:
Is there some kind of magical spell to do the return command (on
the whole script) from within a subroutine (because I imagine that
giving the return command is only returning the subroutine, or
something). The script in question is run as an action script
within Mail. Would tell me to quit work or again are we only
talking to the sub ?
If there's definitely nothing left for the script to do, Jay, you
could simply cancel execution:
----------------
on someHandler()
-- any stuff that needs to be done
error number -128 (* simulates a user cancel *)
end someHandler
----------------
If there are still a few things to do, you could use a custom error
code:
----------------
on someHandler()
-- any stuff that needs to be done
error number 500 (* generally, positive numbers from 500 to 10,000
shouldn't conflict with other error codes *)
end someHandler
on run (* or any other handler *)
try
-- call various subroutines (* these would normally always be
called *)
someHandler()
-- call various other subroutines (* these would not be called if
an error occurs *)
on error number 500
-- do any stuff required before completion
end try
end run
----------------
---
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