Dear All,

I'm a newbie to Window-Eyes--considering making the switch since both of my 
braille displays (a HandyTech Braille Wave, and a GWMicro SyncBraille 20) have 
been 'orphaned' by the company who makes the screen reader I've been using in 
one form or another for the past two decades.  One of the things I will miss 
from the old screen reader is  the AutoAdvance feature, which allows users to 
automatically read through text using a braille display without having to press 
the scroll key thousands of times a day. For those of us who use a VoiceSense 
and SyncBraille, this is a feature built in to VoiceSense, but it doesn't seem 
to have made  its way into Window-Eyes yet.  So, I decided to take a day last 
weekend and write a script to do this.  It may be a bit of a  kludge, but it 
works perfectly for what I need it to do--and  it was great fun to dig into 
Window-Eyes scripting and make something useful that works.  I'm not really 
interested in developing it any further, so I thought I'd pass it along to 
those of you who have more script-writing experience and more time than I do.  
Hopefully someone on this list will be interested in developing it further,and 
packaging it up to post on Script-Central.  I unfortunately don't have the 
time.  but I'm happy with it, it's worked fine for the last week without 
crashing or causing any problems,  and it does exactly what I need.

I'll include the script, below, and then afterwards I'll include a few notes 
and comments about ways I think it could be improved. I've used comment lines 
fairly liberally to document how it works and what each block of code does, so 
it should be pretty transparent.  Basically, autoscroll initiates with 
ctrl-shift-q on the keyboard, and is terminated by the ESC key. Spacebar speeds 
up the scrolling in tenth-of-a-second increments, and backspace 
slows it down correspondingly.  Note that most  people will want to have their 
end-of-line notification dings turned off in the WE Braille menu; also, if 
quick messages are enabled, they need to be dismissed with a routing button 
(this includes the announcements of scroll-time changes spoken by the script, 
too). This works very "jerkily" in Word (for reasons I'll 
comment on at the end  of this message), but works great in reading web pages, 
e-mail messages,  and in wordpad where I've used it to read a book from 
Bookshare.  Here's the script: (hopefully the mail client won't introduce 
spurious line-breaks).

' Begin Braille Auto-Scroll Script
' Alpha version written by Robert Englebretson
' Please feel free to modify, improve, and redistribute
'
' Scrolls the braille display at a regular time interval 
' Initiated by Control-Shift-q
' Terminated by pressing the escape key
' Defaults to a rate of scrolling once every 2.2 seconds (good for a 40-cell 
display)
' Spacebar speeds up the scrolling by increments of one-tenth of a second
' Backspace slows down the scrolling by increments of one-tenth of a second
' New scroll-rate is maintained for the rest of the WE session or until script 
is reloaded
' Other keypresses allowed through as normal (b/c arrows, navigation keys, and 
browse-mode keys are still useful)
'
' define variables
Dim BrailleAutoScrollHotkey
Dim OnStopKey
Dim ScrollDelay
'
' Setup control-shift-q to start scrolling
Set BrailleAutoScrollHotkey = Keyboard.RegisterHotkey("Control-Shift-q", 
"BrailleAutoScroll")
'
' Sets default scroll delay value in MS (adequate for a 40-cell display)
ScrollDelay = 2200
'
' Define the autoscroll subroutine
Sub BrailleAutoScroll()
' Clears the escape-key press from previous session
OnStopKey = False
' Connects to the keyboard keypress and key-release events
Press = ConnectEvent(Keyboard, "OnKeyDown", "Keypress")
Rel = ConnectEvent(Keyboard, "OnKeyUp", "KeyRel")
' Set up the auto-scroll loop 
Do while OnStopKey = false
Sleep ScrollDelay
ExecuteBrailleHotkey bhkScrollBrailleRight
Loop
' Disconnects all events after loop is terminated with esc
Disconnect Press
Disconnect Rel
Speak "AutoScroll Stopped."
End Sub
'
' Set up function for disposition of KeyDown events during scrolling
Function KeyPress(VKCode, Modifiers)
' Terminates the autoscroll loop if esc-key is pressed
If VKCode = 27 then
OnStopKey = true
Keypress = KDDiscard
Exit function
End if
' Increases scroll speed by 0.1 seconds if spacebar is pressed
If VKCode = 32 then
ScrollDelay = ScrollDelay-100
Keypress = KDDiscard
Speak ScrollDelay/1000 & " seconds."
Exit function
End if
' Decreases scroll speed by 0.1 seconds if backspace key is pressed
If VKCode = 8 then
ScrollDelay = ScrollDelay+100
Keypress = KDDiscard
Speak ScrollDelay/1000 & " seconds."
Exit function
End if
End function
'
' Disposition of corresponding KeyUp events 
Function KeyRel(VKCode, Modifiers)
If VKCode = 27 then
KeyRel = KDDiscard
Exit function
End if
If VKCode = 32 then
KeyRel = KDDiscard
Exit function
End if
If VKCode = 8 then
KeyRel = KDDiscard
Exit function
End if
End function
'
' End Braille Auto-Scroll Script

Here are a few comments and suggestions for  anyone who might want to work on 
this further:

(1) This doesn't work well in Microsoft Word 2007, at all.  But then again I 
don't find that Window-Eyes braille works well  in Word either. The problem is  
at the ends of lines,there is a significant lag-time between when the advance 
button is  pressed and when the display actually scrolls.  I don't know why 
this is,or if it's unique to my system--I'd appreciate feedback from other 
users on this. In any case, as a result of the lag in Word when reaching 
line-endings, the autoscroll script doesn't scroll at a regular interval at 
those points.   It acts a bit like an arrhythmic heartbeat...

(2) If I were to develop this script further, it would be nice if the routing 
buttons on the display would stop the script, *and* route the cursor to the 
correct cell.

(3) The script should be made to stop once the cursor stops  moving (i.e. when 
the end of a file is reached.)   Now it just sits and dings until we press 
escape.

(4) It  would be nice to be able to define items in the Braille Hotkey menu to 
do all of the script functions, instead of having to be tied to the keyboard.

(5) When the autoscroll is fast (for example with my SyncBraille 20 I set the 
sleep time to 1.1 seconds), the announcements of time-change are not spoken 
(e.g. when space or backspace is pressed for the script).  I suspect the 
problem is that these are being interrupted by some sort of  program event--and 
so it works well when scrolling is slower than about 2 seconds, but not when it 
is faster.  I haven't been able to determine what is interrupting speech, or 
how to force the message to speak regardless.

(6) Now this is a real pie-in-the-sky wish--but it would be really nice if 
there were a way to determine exactly how much text is being sent to the 
display on each chunk, and for the scrolltime to automatically adjust itself 
accordingly. What I mean is:  this script works great  when the whole display 
is full. 2.2 seconds is exactly the right amount of time (for me) to thoroughly 
read 40 cells. But if only,say, 10 cells of the display have text on them, then 
I have to  wait almost 1.5 seconds for the display to scroll itself--or I have 
to hit the advance button manually.  It would be nice, for example, if the 
script could determine that only 10 cells are showing, and thus scroll that 
particular display-full after only one-fourth the usual time delay.

(7) This probably should be set not to  work if there's no braille display 
connected.

Well,have fun!  I find this quite useful, and I suspect others will too--but I 
don't have the time or expertise to turn this into something I would feel good 
about packaging and making publicly available.  I'd definitely be interested in 
receiving any updated/improved versions that any of you come up with though.

Best,
--Robert Englebretson

******************************************************************
     Dr. Robert Englebretson
     Dept. of Linguistics, MS23
     Rice University
     6100 Main St.
     Houston, TX 77005-1892
     Phone: 713 348-4776
     E-mail: [email protected]
     http://www.ruf.rice.edu/~reng

Reply via email to