[jawsscripts] Re: Need help. script not working

  • From: "Huskins, Wayne" <Wayne.Huskins@xxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 22 Apr 2008 09:29:35 -0300

Lennie one way to avoid getting stuck in a while loop (at least during
testing) is to use the IsKeyWaiting function in the while test as
follows

While x < 10 && !IsKeyWaiting() 

The above gives you the option of pressing a key to stop the loop

Wayne H
-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Lennie Rinaldi
Sent: April 21, 2008 18:52
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Need help. script not working

Hi Dennis,

Thanks so very much for your suggestions. I will definitely will look at
both methods tomorrow. I'll report back how I make out.

I am always uncomfortable using the while loop for the fear of never
getting out of it ending up in a tight loop.

Again, thanks for your help. I didn't realize that I was going about it
the wrong way, but that is how we learn.

Lennie

At 02:52 PM 4/21/2008, you wrote:


        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 <mailto:merlin739@xxxxxxxxx>  
                
                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
                

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

Other related posts: