Point at which speaking is stopped?

Roger Eller roger.e.eller at sealedair.com
Mon Dec 26 16:26:46 EST 2011


On Mon, Dec 26, 2011 at 3:21 PM, Mike Bonner wrote:

> The example isn't great, there are some issues with it but its close at
> least.
>
>  On Mon, Dec 26, 2011 at 1:09 PM, Mike Bonner wrote:
>
> > Yep, in simplest form its not to bad.  I put a bunch of text into a field
> > then to read it, set the itemdelimter to "."  put the field text into a
> > variable and replaced "? " with ?. " same with "! " replaced with "!. "
> (to
> > ensure we still retain punctuation tone changes)
> >
> > So the following script placed in a button will read from field 1.
> > Clicking the button again pauses, Reading picks up where it left off.
> >
> > local tReading, tCurrLine, tTotalLines,tText
> > on mouseUp
> >    if tReading is empty then put false into tReading
> >    put not tReading into tReading
> >    set the label of me to "Reading: " & tReading
> >    startLooping
> > end mouseUp
> >
> > command startLooping
> >    set the linedelimiter to "."
> >    if tReading then
> >       if tCurrLine is empty then
> >          put field 1 into tText
> >          replace "? " with "?. " in tText
> >          replace "! " with "!. " in tText
> >          put the number of lines in tText into tTotalLines
> >          put 1 into tCurrLine
> >       end if
> >
> >       if not revIsSpeaking() then
> >          revspeak line tCurrLine of tText
> >          if tCurrLine = tTotalLines then
> >             put false into tReading
> >             put empty into tCurrLine
> >          else
> >             add 1 to tCurrLine
> >          end if
> >       end if
> >       set the label of me to "Reading: " & tReading
> >       send startLooping to me in 20 milliseconds
> >    end if
> > end startLooping
>

I like it!  I used your post as the text to read aloud via your script.
 With a little more code to add active sentence highlighting, and handle
other oddities in text like ("?" with "?."), it becomes a pretty nice
screen reader that you can follow along visually.  I could see this growing
into a great teaching aid for reading.

˜Roger



More information about the use-livecode mailing list