[jawsscripts] Re: JAWS function for generating random numbers?

  • From: Saylien Brown <saybro@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Sun, 28 Nov 2010 01:10:37 -0500

Thanks Martin for your script. I'll see if it will do the job for me.

At 05:14 PM 11/27/2010, you wrote:
>Saylien,
>
>   A couple of years ago I wrote to this list describing a way of accessing
>certain dot net classes from Jaws scripts.  It is possible to access the
>System.Random class in this way, although with limitations.  I give a script
>below in which repeated calls to that classes' Next () method would give a
>set of pseudo random positive integers, as long as you have a dot net
>framework installed on your machine.  Unfortunately, the returned range is
>from 0 to MaxInt32, or 0 to 2147483647, rather than the the range of 1 to 10
>which you want.  It happens that the Next () method can take an integer
>parameter which limits the maximum value returned, but Jaws scripts cannot
>pass an integer parameter to any object (corrections to this claim would be
>welcome).  As a hack, I divide the returned value by approx one tenth of
>MaxInt32.  This is not a very accurate way of limiting the returned range,
>but seems on testing to give a range of 0 to 10.  Adding 1 to the returned
>value at this stage would give a range of 1 to 11, but you might use a while
>loop to throw away any values higher than 10 and keep calling the method
>until a number in the desired range is returned.
>
>   hth
>
>Martin
>
>Script test ()
>Var object oRand, object oNull, int r
>
>let oRand = CreateObject ("System.Random")
>let r = (oRand.Next () / 214748365)
>
>SayInteger (r)
>
>oRand = oNull
>EndScript
>
>
>
>----- Original Message -----
>From: "Saylien Brown" <saybro@xxxxxxxxx>
>To: <jawsscripts@xxxxxxxxxxxxx>
>Sent: Saturday, November 27, 2010 7:33 PM
>Subject: [jawsscripts] JAWS function for generating random numbers?
>
>
> > Hi,
> >
> > I'm using JAWS 12 under Windows 7 home premium.
> >
> > Is there any function in the Script Manager that will tell JAWS to
> > generate a random number (Between 1 and 10) then store it in a variable?
> >
> > If not, can someone give me an example script I can use to do the above?
> >
> > __________�
> >
> > View the list's information and change your settings at
> > //www.freelists.org/list/jawsscripts
> >
>
>__________�
>
>View the list's information and change your settings at
>//www.freelists.org/list/jawsscripts

__________�

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

Other related posts: