Re: OS-9 question on try with on error
Re: OS-9 question on try with on error
- Subject: Re: OS-9 question on try with on error
- From: Doug McNutt <email@hidden>
- Date: Wed, 9 Jun 2010 15:20:27 -0600
At 18:30 -0500 6/7/10, Luther Fuller wrote:
>On Jun 7, 2010, at 5:24 PM, Doug McNutt wrote:
>
>> While playing around with Excel, on this OS 9 I 8500, I came across some older code that I thought I could simplify. It's also perhaps germane to a previous posting by L R K Perera.
>>
>> What I want is a try - end try block that includes an on error section that will simply quit running the rest of the script in the event of an error. The old code looks like this: (Yes it's an Applescript if you look closely. MPW is one of the best things Apple ever did.)
>
>This will simply stop in case 'do stuff' errors
>
> try
> -- do stuff
> on error
> error number -128
> end try
>
>If you want to exit a handler, replace the 'error ...' with 'return'.
Well. That works, but only if it's run in Script Editor.
With the RunApplescript option in MPW I get:
### RunApplescript: Can't execute script (-1753)
### MPW Shell - Execution of input terminated.
Unfortunately it's the features of MPW that I really want. There are 30 or so lines of script that read the required information from the internet that I don't want to rewrite.
Can you, or someone else, provide a link to the source of information about "error" as an Applescript command and -128 as some kind of special error? Nutshell and Missing Manual are silent. Is "error" a command that's handled only by ScriptEditor? "error with return" seems not to work on a complete script though it might with a handler. Thinking about making the whole script as a handler but that might require mode code than the original which does work.
L R K Perera's request for executing VBA got me back into this and my suggestion about Evaluate didn't work for him because M$ something changed in Excel 2004. Sigh.
Yeah. I understand that AppleScript documentation wasn't so good in the old days. I really should get rid of MS Excel and go to Open Office on Linux where I can write scripts in plain old shell or perl but I'm really attached to OS 9 and this Mac 8500. and Yeah, I have tried learning X-code and objective C. At my age, 75, Idonwannadodat.
--
Applescript syntax is like English spelling:
Roughly, though not thoroughly, thought through.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden