• 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: JollyRoger <email@hidden>
  • Date: Thu, 25 Oct 2001 12:22:40 -0500

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


References: 
 >Re: any way to tell if a script has a 'return' statement? (From: email@hidden)

  • Prev by Date: Re: OT: Open Source Apple Mods
  • Next by Date: Can't Wait
  • 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