[jawsscripts] Re: Function for verifying the contents of a variable.

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 2 Feb 2012 11:03:49 -0500

I know of no function in modern JAWS for classifying the contents of a
variable. However, I do know a few tricks, so here's my shot at a
TypeOf function off the top of my head. Warning: I didn't even try to
compile this.

string function typeOf(variant x)
; Return the JAWS type name that seems best to describe the content of x.
; Types returned: int, object, string.
; Handle and int are indistinguishable, so handles are not identified here.
; Empty (never assigned) values will return string.
; Objects with default properties may return incorrect results.
if x then
        if !stringLength(x) then
                ; An object is the only thing that's boolean True but with 0 
string length.
                return "object"
        elif stringToInt(x) && stringLength(x) == 
stringLength(intToString(stringToInt(x))) then
                return "int"
        else
                return "string"
        endIf
else  ; x is boolean False
        if stringLength(x) then
                ; Integer 0 is all that can do that one.
                return "int"
        else
                ; This may catch more than we want, but it should be close.
                return "string"
        endIf
endIf
endFunction

On Thu, Feb 02, 2012 at 10:44:17AM -0500, Saylien Brown wrote:
Hello,

I'm using the latest build of JAWS 13 under Windows 7.

Does anyone know if there is a JAWS function for confirming if the 
value stored in a variable is a number or text string? Sure there is, 
but looking through the list of over 250 functions to find it has my 
head spinning.

Thanks for any help.

__________???

View the list's information and change your settings at 
//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
__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: