[jawsscripts] Re: Trouble with mod to "System Dialogs.jss"

  • From: "David Farough" <David.Farough@xxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>, "Mark Matthews" <mark.matthews53@xxxxxxxxxxxx>
  • Date: Thu, 25 Oct 2007 13:17:16 -0400

Hi Mark:
 
I noticed the following problem in your script.
 
You were not using the hwnd handle variable when you were using the
GetNextWindow function to move to the next window from the list of
events.  This code should look like this.
 
Let hWND =GetFocus ()
Let hWND=GetNextWindow (hwnd)
Let hWND=GetNextWindow (hwnd)
Let hWND=GetNextWindow (hwnd) ;should hopefully land us on the "Play
Sound Button"
 
 
Your code was repeatedly setting the handle variable to the static text
window which follows the event list.
 
Keep in mind that although you are using the getNextWindow  function to
find out what the next window is in the program structure, you are not
actually changing the window with focus.  All you are doing is assigning
the hwnd variable the value of the next window following the currently
focussed window.  This is why in the next assignment statements it is
important that you use your hwnd variable as the argument in the
GetNextWindow function calls.  This way you will actually load the next
window handle into your hwnd variable.
 
Here is another thing to consider.
 
When you go into home row mode Check to see what the window name is for
the button you are looking for.  I think you will find that the name is:
Play and Stop Toggle.  If this is the case, you could use the findWindow
function to return the handle of that button.  When you code this
function call you first need to provide the handle of the window where
the find is to start from.  This would most likely be the realwindow of
the dialog you were focussed in.  The following function call should
produce the desired results.
 
let hwnd = FindWindow (GetRealWindow (GetFocus ()), "", "Play and Stop
Toggle")
Using this approach will allow you to move to that button no matter
where you are focussed in the dialogue.  If hwnd is not 0, it is safe to
assume that hwnd now contains the handle for the button.
 
Now that you have the handle for the button, you could use the SetFocus
or MoveToWindow functions to move to that window.
 
Here is a description of the FindWindow Function.
 
FindWindow(handle hStart, string sClass, string sWindowName)
 
Category:  Window
 
Synopsis:  finds a window with a specified class or name.
 
Return Type:  handle
 
Return Description:  the window handle of the found window.
 
handle hStart
starting window.
 
string sClass
class name to search for.
 
string sWindowName
the name of the window to find.
 
Description:  This function starts at the specified window and searches
all of its children to find one with the specified Class or Window Name.
If the handle is 0 then a top level window is sought (ie equivalent to
calling FindTopLevelWindow). Leave the name blank to find a window with
a class but any name or leave the class blank to find a window with any
class but a particular name
 
David Farough
Application Accessibility Coordinator/coordonateur de l'accessibilité 
Information Technology Services Directorate /
Direction des services d'information technologiques
Public Service Commission / Commission de la fonction publique
Email / Courriel:  David.Farough@xxxxxxxxxxxxx 
Tel. / Tél:    (613) 992-2779 .
>>> "Mark Matthews" <mark.matthews53@xxxxxxxxxxxx> 09:47 am Monday,
October 15, 2007 >>>
Hi folks.

I'm trying to write a little script that enables the user to simply
press a
keystroke when in the list of events for the default Sound Scheme in
"System
Dialogs.jss" and play the associated sound, without having to Tab to
the
appropriate button, then shift tab back to the List View. Despite
exploring
the relationship between the various windows using the Home Row
utility, and
a few variations to the below code, the intended results still do not
appeared to be yielded. The complete script follows:

Script ClickPlayAndStopToggle ()

Var
Handle hWND

Let hWND =GetFocus ()
Let hWND=GetNextWindow (GetFocus ())
Let hWND=GetNextWindow (GetFocus ())
Let hWND=GetNextWindow (GetFocus ()) ;should hopefully land us on the
"Play
Sound Button"

If GetWindowClass (hWND) =="Button" Then ;checking that the focused
window
is actually of class button
SaveCursor ()
JAWSCursor ()
SaveCursor ()
If FindString (GetFocus (), "Play Sound", S_TOP, S_UNRESTRICTED)
Then
LeftMouseButton ()
EndIf
EndIf

EndScript

I've got a feeling my downfall could be that button to play the
currently
selected event's sound. As you can probably see from the title,
"PlayandStopToggle" is what I thought I was looking for, as when
tabbing
through the dialogue that's what's announced by JFW. However when
doing
further exploration and obtaining some sighted confirmation from a
co-worker, the button appears to be a graphic, and possibly a tool
tip.
Being mindful of this I've substituted FindString with FindGraphic, but
alas
to no avail. Due to slowly running out of ideas, can anyone offer
further
input?

Also whilst I appreciate there are probably more compact ways of
writing the
statements to reach the window in question (in this case the "Play
Sound"
button", I thought writing it in stages would help me de-bug any
problems.

Cheers,

Mark

Mark Matthews
Cardiff, Wales, UK
E-mail/MSN/Windows Messenger:  mark.matthews53@xxxxxxxxxxxx 
Skype:  MMatthews1981
Mobile:  07800 561442 


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

Other related posts: