• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OS-9 question on try with on error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OS-9 question on try with on error


  • Subject: Re: OS-9 question on try with on error
  • From: Stan Cleveland <email@hidden>
  • Date: Wed, 09 Jun 2010 15:11:25 -0700
  • Thread-topic: OS-9 question on try with on error

On 6/9/10 2:20 PM, "Doug McNutt" wrote:

> At 18:30 -0500 6/7/10, Luther Fuller wrote:
>
>> 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.

Hi Doug,

Considering that you're executing AppleScript code in a foreign environment
(MPW), it's almost certain that some operations are disallowed. (For
example, another foreign environment--'osascript' in the shell--does not
allow user interaction, such as the 'display dialog' command.)

Another possibility is that some AppleScript commands could cause side
effects in the MPW environment. In your case, the 'return' and 'error -128'
commands might be interpreted by MPW as requests to abort program execution.

> ...the original [code]...does work.

All things considered, there's nothing wrong with your original code. I
suggest you stick with it. However, I would change the variable name from
'err' to 'noErr' to accurately reflect the results of the 'try' statement.

> 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?

If you want to pursue it, the links below are from Apple's developer docs.

> I have tried learning X-code and objective C. At my age, 75, Idonwannadodat.

Impressive! Use the tools that do the job and work for you. There's nothing
wrong with that!

HTH,
Stan C.

http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/reference/ASLR_control_statements.html#//apple_ref/doc/
uid/TP40000983-CH6g-128973

http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/reference/ASLR_control_statements.html#//apple_ref/doc/
uid/TP40000983-CH6g-129657

http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/reference/ASLR_error_codes.html

http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/reference/ASLR_error_xmpls.html


 _______________________________________________
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

References: 
 >Re: OS-9 question on try with on error (From: Doug McNutt <email@hidden>)

  • Prev by Date: Re: More XML stuff - reading - changing - and writing the file
  • Next by Date: Re: More XML stuff - reading - changing - and writing the file
  • Previous by thread: Re: OS-9 question on try with on error
  • Next by thread: code runs in script editor, hangs as an FBA
  • Index(es):
    • Date
    • Thread