• 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: AS data types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AS data types


  • Subject: Re: AS data types
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 23 Jan 2002 11:43:17 -0800

On 1/23/02 11:19 AM, "Michael Turner" <email@hidden> wrote:

> Does AS provide any technique of reflection for data types (I think it
> is called that). I would like to ask a variable what data type it
> contains. Is this possible? Is there any way to know if I have a valid
> string?
>

Usually 'class' will get it:

set theClass to class of theVariable
if theClass is not string then
beep 3
display dialog "Yikes!"
--or whatever
end if

Be careful with any sort of selection, and with application properties. You
often need to use an explicit 'get' first, or the class is 'property' or
'list'. Although using a variable will usually do that for you. I.e., don't
do:

tell application "Outlook Express'
set theClass to class of (subject of message 1 of folder id 1)
--> property

but:
set theSubject to (subject of message 1 of folder id 1)
set theClass to class of theSubject
--> string

or:
set theClass to class of (get subject of message 1 of folder id 1)
--> string



--
Paul Berkowitz


  • Follow-Ups:
    • Re: AS data types
      • From: Michael Turner <email@hidden>
References: 
 >AS data types (From: Michael Turner <email@hidden>)

  • Prev by Date: Re: Folder Actions: Threat or menace
  • Next by Date: Re: AS data types
  • Previous by thread: AS data types
  • Next by thread: Re: AS data types
  • Index(es):
    • Date
    • Thread