Home arrow FAQ arrow Q1 Frequently Asked Questions arrow MS Accessibility
Apr 24, 2017 at 12:24 AM
Contact Us
MS Accessibility

Active Accessibility is technology developed by Microsoft to make the Windows platform more accessible to people with disabilities. It consists of a set of COM interfaces and methods which allow an application to expose information to third parties, making it easier to implement tools such as magnifiers and screen readers. It proves very useful also for testing utilities. Microsoft has implemented the accesibility interfaces for the standard Windows controls, and also for Office applications and components. Applications from other vendors (such as Netscape) implement Accessibility as well.

Active Accessibility is included in Windows 98, ME, 2000 and XP. It can be installed as a redistributable on Windows 95 and NT 4 (Service Pack 6) but it will only support the English locale. The redistributable is not included in Q1 due to licensing limitations, but can be downloaded for free from Microsoft's site: http://www.microsoft.com. By using the Accessibility SDK application developers can expose properties of their custom controls, making them available for scripting in Q1.

If Active Accessibility is installed, all Q1 wrappers will support the IAccessible interface, which means you can call accessibility methods and properties directly, as in the following example:

// Obtain a regular button control
var button = app.button("Push");

// The button is also an accessible object: click it
// using an IAccessible function

In addition, the wnd object exposes a property called accObj which allows you to retrieve other interfaces than IAccessible. When passing OBJID_NATIVEOM as the object ID, some applications will return a reference to one of their internal (native) interfaces, which present you with a richer set of methods and properties. For example MS Office applications will return references to their own object model, which is documented in the Office SDK. Here's an example:

// Obtain the native interface for a richedit
var document = app.accObj(consts.OBJID_NATIVEOM, "RichEdit20W");

// Use it to manipulate the control. Note that document.Selection is not defined
// by either Q1 or Accessibility, it belongs to a native interface of the richedit control.
document.Selection.Font.Bold = true;
document.Selection.Text = "This was done through an ITextDocument interface";

NOTE: It is important to understand that an Accessibility-enabled application can expose its screen items either as full objects, or as simple elements. A full object has its own properties and methods, can be stored in a script variable and can contain other objects and simple elements. By contrast, a simple element is a virtual element which can only be accessed through its parent object. For example MS Accessibility will expose a list box control as an accessible full-object, and the list box items as simple elements. Same applies for menus and menu items, tree controls and their items and so on. Here's an example of how to access the accName property of a list box and its items:

// Print the name of a list box

// Print the names of the first two list box items

In the above example there is only one script object, the one which represents the list box control. Although list box items are said to support the accName property, this property is only available through this parent object.

As you will see below, most of the IAccessible methods and properties accept an objID which specifies if the property refers to the object itself, or to one of its simple child elements. To specify the object itself, pass 0 (or consts.OBJID_SELF). For convenience this is also the default value of all object IDs, so that list.accName is equivalent to list.accName(0).

For even more ease of use, Q1 also supports passing the child name, or even a regular expression, instead of an object ID.

Copyright (C) 2002-2009 Lightweight Technologies LLC. All rights reserved. Read our Privacy Policy