• 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: Checking if a variable is defined
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking if a variable is defined


  • Subject: Re: Checking if a variable is defined
  • From: Richard Rönnbäck <email@hidden>
  • Date: Sat, 02 Aug 2008 16:59:27 +0200
  • Thread-topic: Checking if a variable is defined

set IsDefined to true
try
    get theVariable
on error
    set IsDefined to false
end try

if IsDefined then
    say "it is defined"
else
    say "it is not defined"
end if



> Från: Jan Erik Moström <email@hidden>
> Datum: Sat,  2 Aug 2008 16:30:57 +0200
> Till: <email@hidden>
> Ämne: Checking if a variable is defined
>
> It's been some time since I did any Applescripting and now I
> can't figure out how to check if a variable exists or not.
>
> I have this script
>
> tell application "OmniWeb"
>      tell first browser
>          set webName to name
>          set webURL to address of active tab
>      end tell
> end tell
>
> and if the currently active tab doesn't contain a web page the
> webURL is undefined after the tell statement is executed (it
> doesn't help if I define webURL before the tell app, it's
> undefined after the script). But I can't figure out how to check
> if webURL exists or not. Can anyone tell me how to do this?
>
>                      jem
> --
> Jan Erik Moström, www.mostrom.pp.se
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> edband.net
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden

 _______________________________________________
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: 
 >Checking if a variable is defined (From: Jan Erik Moström <email@hidden>)

  • Prev by Date: Checking if a variable is defined
  • Next by Date: Re: AppleScript bug/change/feature in iTunes 7.7.1?
  • Previous by thread: Checking if a variable is defined
  • Next by thread: Re: Checking if a variable is defined
  • Index(es):
    • Date
    • Thread