[jawsscripts] try to write script for self-written program

  • From: <marquats@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 2 May 2008 15:01:54 +0200 (CEST)

Hello,

I'm maintaining a program that teaches braille and uses Jaws for speech-
and braille output. I'm unexperienced with scripting and don't get along.

The program is a windows forms application. On the main window there are
two labels. One contains the
speech output, the other the braille output and a signal character to tell
Jaws to re-read the first label.
The script uses ScreenStabilizedEvent() to read the 2nd label and do the
braille output, and if the signal character has changed, it also says the
text on the first label.

This mechanism works so far, but Jaws reads the speech output twice or
more in most cases, and I don't understand why.
I have re-written the NewTextEvent() function, so that it doesn't read any
new text (at least this is my intention). Output is only done in
ScreenStabilizedEvent.

I would appreciate any help. I tried different versions of the script, but
without success. I have also tried to call SetVerbosityLevel and
SetScreenEcho, but I get an error message "call to unknown function ...".


The second problem I have to solve is the braille input. The user shall
enter braille with the 8 braille keys on the braille display. How can I
pass this input to the program? I found out that KeyPressedEvent() is
called every time the user presses a key, including the braille keys. But
I have to determine when the user has released all keys; then a braille
pattern is entered.

Thanks very much for any kind of help,
Thomas Marquardt


PS:
I'm using a 40 minute version of Jaws 8.0 and Windows XP.
The program is written with Visual Studio 2005.
I currently use Handytech Braillestar 40, but I can only sometimes have
the braille display to try things out.

The script follows:



Include "hjconst.jsh"
use "JAWS Braille.jsb"

Globals
Handle ZeilenLabel, ;; label with braille output
Handle SprachLabel, ;; label with speech output
Handle MainWin,
string SprachSig

Void Function NewTextEvent (
  handle hWnd,       ;Handle of window with text that was written
  string sBuffer, int nAttributes, int nTextColor,
  int nBGColor, int nEcho, string sFrName)
;;determine the handles of the labels:
var handle mainwi
if ZeilenLabel == MainWin || SprachLabel == MainWin then
   Let mainwi = GetAppMainWindow(hWnd)
   If GetWindowName (mainwi) == "BSLern" then
       If sFramename == "Sprachausgabe" Then ;;Label with speech output
           Let SprachLabel = hWnd
       ElIf sFramename == "Zeilenanzeige" Then ;;Label with braile output
           Let ZeilenLabel = hWnd
       EndIf
   EndIf
EndIf
EndFunction

Void Function ScreenStabilizedEvent (Handle hWnd)
var  string labeltext,
     string zeilentext,
     string spsig
if ZeilenLabel != MainWin then
   Let labeltext = GetWindowText (ZeilenLabel, false)
   Let zeilentext = StringChopLeft (labeltext, 1)
   Let spsig = StringLeft (labeltext, 1) ;; signal character
   BrailleMessage (zeilentext, 0, 1000000)
endif
; Speech output:
if spsig != SprachSig && SprachLabel != MainWin then ;;if signal changed
    SayMessage (OT_SCREEN_MESSAGE, GetWindowText (SprachLabel, false)) Let
SprachSig = spsig
endif
EndFunction

Void Function WindowActivatedEvent (Handle window)
Let MainWin = GetAppMainWindow(window)
Let SprachLabel = MainWin ;initialize, to make sure that the output is Let
ZeilenLabel = MainWin ;done only if the handles are determined right
EndFunction



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

Other related posts: