[jawsscripts] Re: Some question about UIA

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxx>
  • To: "jawsscripts@xxxxxxxxxxxxx" <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 2 Oct 2018 19:05:29 +0000

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


-- 
Doug Lee, Senior Accessibility Programmer
Level Access - over 1,000 organizations trust us to help them achieve and 
maintain digital accessibility compliance!
mailto:Doug.Lee@xxxxxxxxxxxxxxx  http://www.LevelAccess.com
"While they were saying among themselves it cannot be done, it was done." 
--Helen Keller
__________�

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

Other related posts: