I am running a script from the Finder, i.e. from an Apple Contextual Menu. The script needs to be aborted under some conditions found in subroutines. However, using a command such as “return” only breaks the subroutine, not the main loop. Calls like “quit” and “abort immediately” will quit the Finder - which is not what should happen.
How can I do this…?
Eelco Houwink
You don’t mention trying “error number -128”
Andreas
: I am running a script from the Finder, i.e. from an Apple
: Contextual Menu. The script needs to be aborted under some
: conditions found in subroutines. However, using a command such
: as “return” only breaks the subroutine, not the main
: loop. Calls like “quit” and “abort
: immediately” will quit the Finder - which is not what
: should happen.
: How can I do this…?
Use the ‘error’ keyword to throw an error.
if (someValue is "broken") then error "I'm going to cry now."
See the AppleScript Language Guide for more details - there’s a ton of stuff you can do with ‘error’.
HTH