[jawsscripts] Re: Need help. script not working

  • From: Lennie Rinaldi <merlin739@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 24 Apr 2008 18:11:56 -0400

Hi Dennis,

I inserted the code into the script, but I had a compile error. The message is syntax error om the If condition

If hControl then

Where do I go from here?

Thanks,

Lennie

At 09:23 AM 4/23/2008, you wrote:
Add this to your temperary ScriptFileName test function, then compile and hit Insert+Q:
var
handle hMain,
handle hControl
let hMain=GetAppMainWindow(GetFocus())
let hControl=FindDescendantWindow(hMain,96)
If hControl then
; if it found the control, then move to that window and click the mouse...
    MoveToWindow(hControl)
SayInteger(99)
LeftMouseButton()
PcCursor()
 Else
         SayMessage  (OT_ERROR, "The link album to disc cannot be found")
EndIf

Thanks,
Dennis Brown
----- Original Message -----
From: <mailto:merlin739@xxxxxxxxx>Lennie Rinaldi
To: <mailto:jawsscripts@xxxxxxxxxxxxx>jawsscripts@xxxxxxxxxxxxx
Sent: Tuesday, April 22, 2008 4:26 PM
Subject: [jawsscripts] Re: Need help. script not working

Dennis,

That didn't work either. I still got the error message not found and your script that you suggestted did not say 99.

Very frustrated Lennie

At 03:52 PM 4/22/2008, you wrote:
Try this and see if you get 99 announced:
Add the following script to your script file; compile; then move to the area with the link and hit the key Insert+Q
Script ScriptFileName()
If MoveToControl (GetAppMainWindow(GetFocus()), 96) then
SayInteger(99)
LeftMouseButton()
PcCursor()
 Else
         SayMessage  (OT_ERROR, "The link album to disc cannot be found")
EndIf
EndScript

I always use this as a test script in order to test parts of the script's code without executing the entire script I'm currently working upon.
Let me know what happens.

Thanks,
Dennis Brown
----- Original Message -----
From: <mailto:merlin739@xxxxxxxxx>Lennie Rinaldi
To: <mailto:jawsscripts@xxxxxxxxxxxxx>jawsscripts@xxxxxxxxxxxxx
Sent: Tuesday, April 22, 2008 3:42 PM
Subject: [jawsscripts] Re: Need help. script not working
Hi Dennis,
Yes, the link still cannot be found. I double checked the control ID and it is 96. I changed the script to your suggestion below and the darn thing still cannot be found.
Thanks,
Frustrated Lennie
At 03:25 PM 4/22/2008, you wrote:
Are you getting the message that the link cannot be found?
Try changing hGrip to
let hGrip=GetAppMainWindow(GetFocus())
Thanks,
Dennis Brown
----- Original Message -----
From: <mailto:merlin739@xxxxxxxxx>Lennie Rinaldi
To: <mailto:jawsscripts@xxxxxxxxxxxxx>jawsscripts@xxxxxxxxxxxxx
Sent: Tuesday, April 22, 2008 3:05 PM
Subject: [jawsscripts] Re: Need help. script not working
Hi Dennis,
Unfortunately, I still cannot get the script to work. I included the modification as you suggested, but somehow I must be missing something. I omitted the part of checking for album tag. The control ID that I am trying to get to does not have a MSAA object name.
Thanks for your help.
Lennie
The script is below:
Script GoToLinkAlbum ()
Var
handle hGrip,
string sLink
let sLink = "Link album to disc"
TypeKey (cKSDetail)
TabKey ()
let hGrip = GetCurrentWindow ()
If MoveToControl (hGrip, 96) then
SayWord ()
Else
        SayMessage  (OT_ERROR, "The link album to disc cannot be found")
SaveCursor ()
RouteJAWSToPc ()
JAWSCursor ()
JAWSPageUp ()
JAWSEnd ()
LeftMouseButton ()
RestoreCursor ()
EndIf
EndScript
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: <mailto:merlin739@xxxxxxxxx>Lennie Rinaldi
To: <mailto:jawsscripts@xxxxxxxxxxxxx>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: