[jawsscripts] Re: the BOOL variable type in Gordons example?

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Fri, 23 Jul 2010 09:54:52 -0400

Bool has technically been around for a very long time, probably even
back as far as JAWS 3, but I've never seen it used, nor seen reason to
use it.  It's probably never been tested, and not documented either
because it's really not much more in JAWS than another name for Int.
And as you discovered, Int works better. :)

On Fri, Jul 23, 2010 at 11:50:21PM +1000, Paul Magill wrote:
Hi Gordon and all,

Well, I was most surprised, and pleased, to see the BOOL variable type in 
your function header below.

I cant remember it being mentioned before. When did we get the BOOL type?

In the version 11 documentation, I looked through the FSDN, & the scripting 
manual, but found no mention of it.

I tried it as a var declaration:

Function TestFunction ()
VAR
BOOL  OnOff

and that compiled fine, but I was unable to assign a value to it.

let OnOff = 1
 gave the compile error, expected an integer, not a bool.

Could you provide any further information about the Bool type please...

Thank you,
Paul from Aust

String function GetTimeName(String sTime,int iSegment,String sTimeName,bool
bShowZero)
Var
int iAmount

; Turn the string into an integer for easier processing
let iAmount = StringtoInt(StringSegment (sTime, ":", iSegment))

; Is there any time here and do we need to show it?
if (iAmount == 0) && (bShowZero == false) then
return ""
endif

; If we've only got 1 then we don't want to pluralise the amount
if (iAmount == 1) then
return "1 " + sTimeName
endif

; Return the value with the time interval pluralised
return IntToString(iAmount) + " " + sTimeName + "s"
endfunction

String function StringTime(string sTime)
Var
string sresult,
string sEnd

; Make sure we have 3 segments
while (StringSegmentCount (sTime, ":") < 3)
let sTime = "00:" + sTime
endwhile

; Get the time in hours and minutes
let sResult = StringTrimTrailingBlanks (GetTimeName(sTime,1,"hour",false)
+ " " + GetTimeName(sTime,2,"minute",false))

; Get the seconds time
let sEnd = GetTimeName(sTime,3,"second",true)

; If we've got only seconds then that's all we send back
if (sResult == "") then
return sEnd
endif

; Join the two times together with the word and
return sResult + " and " + sEnd
endfunction

Script Test ()
   SayString(StringTime("01:42"))

EndScript

Gordon Luke

__________???

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
__________�

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

Other related posts: