[jawsscripts] Re: Schedule Function

  • From: "E.J. Zufelt" <lists@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 15 Apr 2009 16:45:56 -0300

Good afternoon Dean,

I did not look through your code.  However, it sounds to me like you  
need a global variable that can be set to On or Off so that your  
function can know if it should stop or not.

1. Create a global variable to store a binary state of on or off

2. When the reading function starts set the variable to on

3. When the control key is pressed set the variable to off

4. In your reading function check the state of the global variable  
before reading the next line.

HTH,
Everett

Follow me on Twitter
http://twitter.com/ezufelt

View my LinkedIn Profile
http://www.linkedin.com/in/ezufelt

On 15-Apr-09, at 4:35 PM, Dean Masters wrote:

> I have written a set of scripts and functions to read text  
> continuously in a
> Bible software program. It reads to the end of the screen then moves  
> to the
> next screen and reads from there. I got it to stop reading when i  
> hit the
> control button but then I noticed that the ScheduledFunction stil  
> goes on at
> the time alotted. so I am reading and stop the reading. After the  
> allotted
> time I hear the ScheduledFunction start and run. Here is the  
> function where
> I call the ScheduledFunction:
>
> Void Function TopOfText ()
>
> VAR
>
> string LastLine,
>
> Int iKeyWasPressed, ;use this to terminate the while loop.
>
> string sScheme,
>
> string sScheme1,
>
> string sScheme2
>
> InvisibleCursor ()
>
> Let LastLine = GetLine (); saves first line
>
> SayLine ();speaks first line
>
> JAWSHome ()
>
> NextLine ();scrols to next line
>
> Pause ()
>
> Let CurrentLine = GetLine ();saves new line
>
> While (CurrentLine != LastLine && iKeyWasPressed ==0);speak if two
> adjacentlines are dissimilar or if a key was pressed
>
> Let iKeyWasPressed = IsKeyWaiting () ; set variable to true if a key  
> was
> pressed.
>
> If iKeyWasPressed then
>
> Return
>
> ElIf iKeyWasPressed ==0 then
>
> SayLine ()
>
> Let LastLine = CurrentLine; sets up for new comparison
>
> NextLine ();scrolls down one line
>
> Let CurrentLine = GetLine (); saves the new line
>
> EndIf
>
> EndWhile;loop until the two lines are the same
>
> If iKeyWasPressed then
>
> Let sScheme = GetCurrentSchemeName ();scheme set for sounds which is  
> to be
> turned off for this script
>
> If GetCurrentSchemeName () != "LDLS" then
>
> Let sScheme1 = sScheme
>
> Let sScheme2 = sScheme
>
> Else
>
> Let sScheme1 = "Classic"
>
> Let sScheme2 = "LDLS"
>
> EndIf
>
> Let g_ChapterAndVerseToggle = 0;mutes speaking of the chapter and  
> verse
>
> SwitchToScheme (sScheme1);switches to the classic scheme if in LDLS  
> scheme
>
> Return
>
> Else
>
> PCCursor ()
>
> TypeKey ("spacebar");new keystroke in Libronix 3c to go to next screen
>
> scheduleFunction ("PositionForNextRead", 200)
>
> EndIf
>
> EndFunction
>
>
>
> How can I keep the ScheduledFunction from running when I want to stop
> reading?
>
>
>
> Thanks,
>
> Dean
>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts

__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: