[jawsscripts] Re: Variant data type in JAWS scripts
- From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
- To: jawsscripts@xxxxxxxxxxxxx
- Date: Wed, 24 Sep 2008 16:41:35 -0400
Heuristically I'm afraid:
if v then
if !stringLength(v) then
; Only an object can have length 0 and remain boolean True.
return "object"
elif stringLength(v) == stringLength(intToString(v)) then
; Looks like a number.
return "int"
else
; Looks like a string.
return "string"
endIf
else
; Looks like nothing at all.
return "null"
endIf
That's from memory and prone to error, and it won't tell you the
difference between a null string and a never-set variable, but it's
about as close as we can get without a lot of fancy footwork. Long
long ago, maybe in JAWS 3.7 or so, there were undocumented functions
for testing data types, like VariantIsNull, VariantIsNumber, and
IsUndefinedObject. But they were taken out years back for some
reason.
On Wed, Sep 24, 2008 at 04:26:47PM -0400, Jamal Mazrui wrote:
Thanks, Doug. If a function is defined with a variant parameter, do you
know how its subtype can be determined at runtime?
Jamal
On Wed, 24 Sep 2008, Doug Lee
wrote:
> Date: Wed, 24 Sep 2008 13:29:44 -0400
> From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
> Reply-To: jawsscripts@xxxxxxxxxxxxx
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Variant data type in JAWS scripts
>
> Variant is an undocumented variable type in JAWS scripting that I have
> often used in order to obtain a degree of polymorphism. I boldly
> assume that you are taking interest in this after examining some of
> the BX source code. <grin>
>
> In any case, yes, the compiler doesn't fully support Variant, but it
> does partially. You can't say "let v = 0," but you can say "let v =
> vcast(0)" if vcast() is defined as
>
> variant function vcast(variant v)
> return v
> endFunction
>
> olutil.jsl contains a version of that little piece of glue, under the
> name olVCast().
>
> On Wed, Sep 24, 2008 at 01:00:28PM -0400, Jamal Mazrui wrote:
> I would like to learn more about how the variant data type may be used in
> JAWS scripts. Apparently, it may be used as a parameter or return value,
> as well as a local or global variable. When I tried to assign a number to
> a variant variable, however, the compiler complained about a type
> mismatch. I find no functions specifically for converting to or from
> variants. Does anyone know what conversions are done automatically and
> what conversions can be done with existing conversion functions like
> IntToString?
>
> Jamal
>
> __________?
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> --
> Doug Lee, Senior Accessibility Programmer
> SSB BART Group - Accessibility-on-Demand
> mailto:doug.lee@xxxxxxxxxxxxxxxx http://www.ssbbartgroup.com
> "While they were saying among themselves it cannot be done,
> it was done." --Helen Keller
> __________?
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
__________?
Visit and contribute to The JAWS Script Repository http://jawsscripts.com
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
--
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________
Visit and contribute to The JAWS Script Repository http://jawsscripts.com
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
- References:
- [jawsscripts] Variant data type in JAWS scripts
- From: Jamal Mazrui
- [jawsscripts] Re: Variant data type in JAWS scripts
- From: Doug Lee
- [jawsscripts] Re: Variant data type in JAWS scripts
- From: Jamal Mazrui
Other related posts:
- » [jawsscripts] Variant data type in JAWS scripts
- » [jawsscripts] Re: Variant data type in JAWS scripts
- » [jawsscripts] Re: Variant data type in JAWS scripts
- » [jawsscripts] Re: Variant data type in JAWS scripts
- [jawsscripts] Variant data type in JAWS scripts
- From: Jamal Mazrui
- [jawsscripts] Re: Variant data type in JAWS scripts
- From: Doug Lee
- [jawsscripts] Re: Variant data type in JAWS scripts
- From: Jamal Mazrui