[jawsscripts] the BOOL variable type in Gordons example?

  • From: "Paul Magill" <magills@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 23 Jul 2010 23:50:21 +1000

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

Other related posts: