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

  • From: "Gordon Luke" <Gordon.Luke@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Fri, 23 Jul 2010 15:04:12 +0100

Hi

Hands up - that was my mistake - I should have used int.  To be honest I'd
been writing in C# and just wrote the function for Geoff this morning
without much thought on Jaws's limitations.  As it compiled I just left it.

So sorry for any confusion this may have caused.

Gordon Luke
Capita IT (CAIM)


                                                                       
             Doug Lee                                                  
             <doug.lee@ssbbart                                         
             group.com>                                                 To
             Sent by:                  jawsscripts@xxxxxxxxxxxxx       
             jawsscripts-bounc                                          cc
             e@xxxxxxxxxxxxx                                           
                                                                   Subject
                                       [jawsscripts] Re: the BOOL variable
                                       type in Gordons example?        
                                                                       
             23/07/2010 14:54                                          
                                                                       
             Please respond to                                         
             jawsscripts@freel                                         
                 ists.org                                              
                                                                       
                                                                       




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




This email is confidential and should not be used by anyone who is not
the original intended recipient. Prudential cannot accept liability
for statements made which are clearly the sender's own and not made
on behalf of the Prudential. In addition, no statement should be
construed as giving investment advice within or outside the United
Kingdom.

Prudential plc, incorporated and registered in England and Wales.
Registered Office at Laurence Pountney Hill, London, EC4R 0HH.
Registered number 1397169. Prudential plc is a holding company,
subsidiaries of which are authorised and regulated by the Financial
Services Authority (FSA).

'Prudential' is a trading name of The Prudential Assurance Company
Limited, which is incorporated and registered in England and Wales.
Registered Office at Laurence Pountney Hill, London, EC4R 0HH.
Registered number 15454. Authorised and regulated by the Financial
Services Authority. 'Prudential' is also used by other companies within
the Prudential Group, which between them provide a range of financial
products including life assurance, pensions, savings and investment
products.

'Prudential' is also a trading name of Prudential Distribution Limited, 
which is incorporated and registered in Scotland.  Registered Office at 
Craigforth, Stirling, FK9 4UE.  Registered number SC212640. Authorised 
and regulated by the Financial Services Authority.

A list of other Prudential companies together with their registered
statutory details can be found in 'About Prudential' on 
http://www.prudential.co.uk

An email reply to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.

__________�

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

Other related posts: