Re: AS data types
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