[jawsscripts] Re: Plese help with this basic script

  • From: John Martyn <johnrobertmartyn@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Sun, 19 May 2013 01:13:33 -0700

First off, you are looking at same logical level instead of many parents.
You can only have one parent of an object. Here is some code you can play
with. I use it in Lind Tunes to find windows traversing the window
structure. This is a good function to keep around. Modify it for your needs.
John Martyn
HANDLE Function GetTargetName (string tWinName, string tWinClassName, int
skip)
var
handle cWin,
string cWinName,
string cWinClassName,
handle nWin,
string direction,
handle childWin,
handle parentWin,
string converted,
int flagged,
int continue,
int safety,
int classFlag,
int skipCount

let cWin = ApplicationMainWindow
let safety = 1
let flagged = 0
let direction = "down"
let continue =0
let classFlag = 1

while continue== 0 

if cWin == ApplicationMainWindow then
if flagged == 1 then
;Say ("The specified window was not found",3)
return
endif
let flagged = 1
let cWin = GetFirstChild (cWin) 
let cWinClassName = GetWindowClass (cWin)
else

if direction == "down" then
let childWin = GetFirstChild (cWin)
if childWin == 0 then
let nWin = GetNextWindow (cWin)
if nWin == 0 then
let direction = "up"
let cWin = GetParent (cWin)
let cWinClassName = GetWindowClass (cWin)
else
let cWin = nWin
let cWinClassName = GetWindowClass (cWin)
;SayString ("next window")
endif
else
let cWin = childWin
let cWinClassName = GetWindowClass (cWin)
;SayString ("next child")
endif
elif direction == "up" then
let nWin = GetNextWindow (cWin)
if nWin == 0 then
let direction = "up"
let cWin = GetParent (cWin)
let cWinClassName = GetWindowClass (cWin)
else
let cWin = nWin
let cWinClassName = GetWindowClass (cWin)
;SayString ("next parent")
let direction = "down"
endif
endif
endif

let cWinName = GetWindowName (cWin)
;Say (cWinName, 3)
;Say (cWinClassName, 2)


if StringCompare (cWinClassName, tWinClassName, 0) == 0 && StringCompare
(cWinName, tWinName, 0) == 0 then
let skipCount = skipCount+1
if skipCount == skip then
;SayString ("The window has been found")
;Say (cWinName, 3)
;sayinteger(cWin)

let continue = 1
return cWin
endif
endif

if safety == 500 then
;SayString ("safety has been triggered")
return
endif
let safety = safety+1
endwhile
EndFunction



-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Alcidonislaw
Sent: Saturday, May 18, 2013 11:49 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Plese help with this basic script

Hello gang:

I am in the process of writing this script. My intention is to crawl pass a
few windows to get to the window I want to click on. However, as you will
see in my commented script, the "GetParent" function doesn't want to go pass
the first parent. What is it that I am doing wrong? Shift F2 using the
utility indicates there are more than one parent window there for me to
crawl through.

Script QuickClicks ()
var
Handle hw,
String shw

Let hw = GetAppMainWindow (GetCurrentWindow ()) ; found my focus window just
fine If GetControlName () == "STILISTBOX" then ; This tells me I am in the
window where I want to be because that's where I need to start to crawl
through its parent, and its parent's parent.
let shw = GetWindowClass (GetParent (GetFocus ())) ; my first attempt to
crawl pass the first parent. I was successful.
If hw then ;If it is the first parent that I just found.
let shw = GetWindowClass (GetParent (GetFocus ())) ; my second attempt to go
to the next parent (after that I would have one more to go) Say (shw,
Ot_Status, false) ;it reports that I am still on the first parent. 
In other words, my second attempt did not work.
Else
Say ("not found", OT_Status, false)

Endif
Endif

EndScript

Please help me understand how to crawl through a bunch of parents to get to
the one window...

Thank you



Rod 

__________�

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

__________�

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

Other related posts: