• 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: any way to tell if a script has a 'return' statement?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: any way to tell if a script has a 'return' statement?


  • Subject: Re: any way to tell if a script has a 'return' statement?
  • From: "Marc K. Myers" <email@hidden>
  • Date: Thu, 25 Oct 2001 14:16:01 -0400
  • Organization: [very little]

> Date: Thu, 25 Oct 2001 12:22:40 -0500
> Subject: Re: any way to tell if a script has a 'return' statement?
> From: JollyRoger <email@hidden>
> To: Applecript Users <email@hidden>
> CC: <email@hidden>
>
> On 10/25/2001 11:40 AM, "email@hidden" <email@hidden> wrote:
>
> >> I want to be able to save the result returned by a script to a file, but
> >> since the result will always have something in it (something I don't want to
> >> save if the script doesn't specifically return a value), how do I tell
> >> whether or not I should be saving the result variable? I won't know a priori
> >> if the script I am running has a return statement.
>
> Just off the top of my head: One way might be to (a) assign the result of
> the handler call to a variable, and then (b) wrap the call to the script
> handler in a try statement. If the return value of the handler is
> undefined, no return statement was used. Something like this:
>
> try
> set myVar to ScriptObject's Handler()
> get myVar
> on error
> -- myVar is undefined
> -- (you might figure out what error number this is
> -- and only handle that particular error number)
> end try

The return value wouldn't be undefined. If there is no explicit
"return" statement the return value would be the result of the last
command executed.

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[10/25/01 2:15:14 PM]


  • Follow-Ups:
    • Re: any way to tell if a script has a 'return' statement?
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: run script
  • Next by Date: RE:Subject: Adjusting height of textbox in Qxp
  • Previous by thread: Re: any way to tell if a script has a 'return' statement?
  • Next by thread: Re: any way to tell if a script has a 'return' statement?
  • Index(es):
    • Date
    • Thread