[jawsscripts] Scripting question

  • From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Wed, 1 Jan 2014 14:53:39 +0200

Hello and happy new year!

I tried to create a script that speaks the number of messages in a folder in 
Windows Live Mail, but there are important things that don't work and I 
don't know why.

I have added a few comments in this script below. This script is activated 
with the hotkey Insert+PageDown, which is useless in WLM:

Script NumberOfMessagesInAFolder ()
    var String obj = GetWindowClass (GetFocus())  ;get the class of the 
object with focus

    ;press tab once if the focus is not in the tree view and get the new 
object with focus
    If obj != "WLXDUI" Then
        {Tab}
        obj = GetWindowClass (GetFocus())
    EndIf

    SpeechOff()   ;make Jaws not speak anything for the moment
    {Shift+F10}   ;open context menu
    {UpArrow}   ;select the properties menu element
    {Enter}   ;open the properties window
    delay(5)   ;allow some time for that window to open
    RouteJAWSToPc ()   ;activate Jaws cursor and move it in this properties 
dialog window
    {PageDown}  ;move the Jaws cursor at the bottom of the properties window
    {UpArrow}  ;move the Jaws cursor one line up, where appears the number 
of messages
    var String nr_messages = GetLine ()  ;read the line and store it in 
nr_messages var
    {Escape}  ;press escape and close the properties window
    SpeechOn()  ;activate speech
    SayString("test" + nr_messages)  ;say the line with the number of 
messages
EndScript

All well and fine, but the single problem is that it doesn't work. :-)

If the currently selected folder is say "Deleted items", then pressing 
Insert+Page Down to run this script just makes Jaws to speak "test Deleted 
Items", so the GetLine() function is executed immediately and it reads the 
name of the folder. (I added that string "test" + the number of messages to 
be sure that this line is executed).

You've seen that I used delay(5) to wait for the properties window to open 
for 0.5 seconds.
Even if I use a much longer time, Jaws waits that time without speaking 
anything, but then it still speaks the name of the current folder.

I thought that maybe GetLine() reads the line where the PC cursor is, and 
not the Jaws cursor, but I read that this function  uses the active cursor, 
and the active cursor after JawsToPC is the Jaws cursor.
I even added another line that explicitly turns on the Jaws cursor, but it 
worked the same.

You've also seen that I added a line with {Escape} that closes the 
properties window. I even commented that line to not close the properties 
window, but still the folder name was spoken.

Do you have any idea what is missing? Should I add another function that 
specifies somehow that the active window is the properties dialog or 
something like that?

Thanks.

--Octavian 

__________�

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

Other related posts: