• 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: Test for existence of a variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test for existence of a variable?


  • Subject: Re: Test for existence of a variable?
  • From: "Gary (Lists)" <email@hidden>
  • Date: Thu, 11 Aug 2005 10:35:51 -0400

"Mark J. Reed" wrote:

> Is there any way to
> test to see if a variable has been defined? This code snippet works great if
> the global variable _ has been assigned a value.

Get familiar with 'try'.

Try, catch the error, do what you want.

> global _
> set saved_ to _
> (* do stuff with _ *)
> set _ to saved_

global someRealVariableNameNotJust_
try
set saved_ to someRealVariableNameNotJust_
-- do stuff with someRealVariableNameNotJust_
on error
-- do other stuff someRealVariableNameNotJust_
end try

...wfm.
--
Gary

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Test for existence of a variable? (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: MS Entourage to Text file
  • Next by Date: Re: Test for existence of a variable?
  • Previous by thread: Test for existence of a variable?
  • Next by thread: Re: Test for existence of a variable?
  • Index(es):
    • Date
    • Thread