[jawsscripts] Re: Some question about UIA

  • From: Udo Egner-Walter <udo.egner-walter@xxxxxx>
  • To: "jawsscripts@xxxxxxxxxxxxx" <jawsscripts@xxxxxxxxxxxxx>
  • Date: Wed, 3 Oct 2018 09:24:17 +0200

Hello Doug,

thank you very much for that overview.

Do you know if "FindByAutomationId()" returns an element as well? If it 
returns an element how can I focus the object since "oUIA.SetFocus ()" 
in my example doesn't work?

Allow me another question. My Application has only one handle and it's 
the application handle. If I use "getElementFromHandle" I suppose I had 
to search the whole object tree. If I use FindFirst or FindAll command 
there are two parameters: TreeScope and FSUIACondition. How can I found 
out more about these parameters? Are these parameters declared in the 
UIA.jsh?

Thank you again for your answer, best wishes

Udo


Am 02.10.2018 um 21:05 schrieb Doug Lee:

More than I can answer thoroughly now, but you basically have these elements 
of the process:
- Get a UIAScriptAPI object, which I think you already did.
- Get an element with a call against that object, like getFocusedElement, 
getElementFromHandle, etc.
- Find the object you want.

The last one, of course, can be the hard part. You have these means:
- Tree walkers, which are slow but reliable.
- FindFirst and FindAll, which can be faster but do not always find 
everything.

It may go without saying that it helps to start on an object as close to your 
destination as possible for walkers, and to start on an object with as few 
objects under it as possible while containing your target object with
findAll and findFirst.

Finally, beware that findAll returns an array of elements whereas findFirst 
just returns an element.

On Tue, Oct 02, 2018 at 08:38:49PM +0200, Udo Egner-Walter wrote:
Hi UIA experts,
the SetFocus () function can bring the focus to a control if one have
the window handle. I wonder if there is a similar function for UIA or
how to create one.

For example:

var

object oUIA,

string MY_AUTOMATION_ID = "ApplyBtn"

oUIA = GetUIAObjectTree(GetAppMainForm(GetFocus()))

if oUIA then

  ?????????????????????? let oUIA = oUIA.FindByAutomationId(MY_AUTOMATION_ID)

  ?????????????????????? if oUIA then

  ?????????????????????????????????????????????? ; set the focus ??

  ?????????????????????? EndIf

EndIf

I had a look at JAWS UIA Script API at
https://www.freedomscientific.com/Support/JAWSDocumentation/UIAScriptAPI
but found it a little confusing.

There are different objects, for example "FSUIA" and "FSUIAElement". The
FSUIAElement has a element "bool SetFocus();".

At the beginning you can read: "The primary object in the JAWS UIA
script API is FSUIA. Using this object, you can get other objects that
represent UIA elements, get tree walkers which will allow you to
traverse the tree of UIA elements, register for UIA events, and more."

But how to get an object UIAElement?

Do someone know: is "oUIA =
GetUIAObjectTree(GetAppMainWindow(GetFocus()))" an object of type FSUIA
and do I need to create an object "FSUIAElement"? How can I do this?

How can I execute a button? Does someone have a code example?

Thank you in advance

Udo




__________???

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



__________�

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

Other related posts: