[jawsscripts] Re: Need help. script not working

  • From: "Dennis Brown" <DennisTBrown@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Mon, 21 Apr 2008 14:52:11 -0400

Instead of a While loop and multiple tab presses, a couple of shortcut methods 
you can use are:
1. If you already have the window handle in hGrip, and already know the control 
ID is 96, then use
If MoveToControl(hGrip,96) Then
    ; Finds, then moves mouse to the link...
    LeftMouseButton()
    PcCursor()
Else
    Say("Link not found.",ot_error)
EndIf
It will activate the JawsCursor and move to the control.
All you need is the LeftMouseButton and PcCursor().

2. If it has an MSAA object name...you can manually go to the link, and while 
on that puppy, do the following:
a. Hit Insert+Space to activate Home Row.
b. Hit F9 and F10 to cycle through the MSAA values (if it has any), and see if 
the MSAA name has any text.  
c. Press Insert+Space to toggle out of Home Row mode.
If it has an MSAA name with the same text as what you have saved in sLink, then 
use the following to move to, and activate that puppy:

If ClickObjectByName(hGrip,sLink,1) Then
    ; Finds, and clicks on the link, if it is there.  
    Return
Else
    ;If it isn't, then it returns the error message.
    Say("Link not found.",ot_error)
    EndIf


These methods should shorten your script, and thereby make it less prone to 
errors when executing.
Hope this helps!

Thanks,
Dennis Brown
  ----- Original Message ----- 
  From: Lennie Rinaldi 
  To: jawsscripts@xxxxxxxxxxxxx 
  Sent: Monday, April 21, 2008 1:47 PM
  Subject: [jawsscripts] Need help. script not working


  Hi Listers,

  I have a script that I want to use to cut down the number of keystrokes to 
get to a particular button.

  The application is a CD catalogue program and when I manually add a new CD, I 
need to go to the "Link album to disc" button to calculate the total time of 
the CD.

  My script is not working. I open up a detail window to move to varrious 
information pertaining to the CD, such as the album title, genre, total time 
etc., but when I use a shortcut key to move to the button, I always get the 
message that the "Link the album to disc" cannot be found.

  My script is below. Thanks for any help or suggestions.

  Lennie

  The script starts here:

  Script GoToLinkAlbum ()

  Var

  handle hGrip,

  string sAlbum,

  string sLink,

  int iCount

  let sAlbum = "Album"

  let sLink = "Link album to disc"

  let iCount = 0

  TypeKey (cKSDetail)
  ; open the album detail window

  SaveCursor ()

  RouteJAWSToPc ()

  ;SayWord ()

  If GetWord () != sAlbum then

          SayMessage (OT_ERROR, "You must be in an album to perform this 
function. Request cancelled")

  JAWSCursor ()

  JAWSPageUp ()

  JAWSEnd ()

  LeftMouseButton ()

  RestoreCursor ()

          Return

  EndIf

  RestoreCursor ()

  TabKey ()

  ; This tab moves to the list of various controls pertaining to the album

  let hGrip = GetCurrentWindow ()

  let iCount = 1

  while iCount < 19
  ; Look for Control ID 96 which is the 18th item pertaining to the album

  GetControlID (hGrip)

  If (GetControlID(hGrip) != 96) then

  let iCount = iCount + 1

  TabKey ()
  ; move to the next item

  let hGrip = GetCurrentWindow ()

  else

  let iCount = 20
  ; We found it

  EndIf

  EndWhile

  If (iCount == 20) then
  ShiftTabKey ()
  ;move to "Link album to disc"

          SayWord ()

  Else

           SayMessage  (OT_ERROR, "The link album to disc cannot be found")

  SaveCursor ()

  RouteJAWSToPc ()

  JAWSCursor ()

  JAWSPageUp ()

  JAWSEnd ()

  LeftMouseButton ()
  ; close the detail window

  RestoreCursor ()

  EndIf

  EndScript

Other related posts: