Accessible objects

See also: acc


You can work not only with windows, but also with user interface (UI) objects that are in windows. Most of them are child windows ("controls") and can be identified by handle. You can use function id or child to retrieve child window handle. But not all objects are child windows. For example, links and other objects in web pages are not child windows, and functions id and child cannot find them. The alternative is accessible objects.

Accessible objects and Acc class

Accessible objects are user interface objects (buttons, links, etc) that can be manipulated (find, click, etc) through COM interface IAccessible. The service is provided by MSAA (Microsoft® Active Accessibility®).


To store a reference to an accessible object, QM uses class Acc.


class Acc IAccessible'a elem


a - pointer to object's IAccessible interface.

elem - child element id. With most objects it is 0. Used with simple element objects, such as list items.


A variable of class Acc fully identifies an accessible object, regardless of whether it is full object or simple element.


To find an object and initialize an Acc variable, use function Acc.Find or acc. To create code for it, use dialog 'Find Accessible Object'.


The Acc class has functions to manipulate an object. To create code for them, you can use dialog 'Accessible Object'.


The common syntax is:


[result = ]a.Function([parameters])




int w=win("QM TOOLBAR" "QM_toolbar")
Acc a.Find(w "PUSHBUTTON" "Windows, controls" "class=ToolbarWindow32[]id=9999" 0x1005)
err ret ;;return if not found. If without flag 0x1000, use this instead: if(!a.a) ret
str name=a.Name


On failure, the functions throw error, therefore you should understand error handling. Note that different kinds of accessible objects support different sets of functions. You should call only supported functions, or be prepared to handle error.


Also you can use functions of IAccessible interface. Call them through member a of Acc variable. Use elem where needed. Example:


Acc a.Find("Quick Macros" "MENUITEM" "Tools" "class=ToolbarWindow32")
out a.a.KeyboardShortcut(a.elem)

'Find Accessible Object' dialog tips

There are 2 ways to capture an object:

  1. Drag the "Drag" tool, and drop on an object. While dragging, you can right-click to switch to another window.
  2. Right click the "Drag" tool, click "Capture when Shift pressed", move the mouse to an object, and press Shift key.

After capturing, click the Test button. If it says "Object not found", try to change some values in the dialog.


If it finds wrong object, try to capture an adjacent object. Test it, check Navigate, and enter post-navigation string. Read more about navig parameter of acc. Example: pa n2 c15 f. Explanation: get parent object, get next object two times, get 15-th child object, get first child object.


If the search time is too long, try to check 'in reverse order' and/or 'as Firefox node'.


The coordinates (x, y) are in the client area of the window.


At the bottom of the dialog - object tree. It shows accessible objects that are in the window. Shows their properties and relationships. By default, it does not show invisible and useless objects. Invisible objects are gray.


To show the dialog you also can use the Ctrl+Alt+Shift+W menu. You can change the hotkey in Options. If the currently active window has always-on-top style, the dialog also will be always-on-top.


To capture objects in Windows 8 full-screen windows, make the dialog always-on-top (open with Ctrl+Alt+Shift+W or right click the "Drag" tool). QM should be running as Administrator or uiAccess, not as User; you can set it in Options. Or capture with Shift.

Using in web pages

Accessible objects in web pages are supported in Internet Explorer, Firefox, Chrome and Opera.


In Chrome and Opera, accessible objects are disabled by default. QM tries to enable when need. If it fails, use one of:


Firefox accessible objects are disabled by default. Firefox enables it when some program tries to get its accessible objects. May need to restart Firefox, or in Firefox Options disable multi-process mode.


Note: enabling web browser's accessible objects can make large web pages load slower.


Note: From time to time, web browsers introduce new features or bugs that break some QM functions. If something stopped working, you can: download new QM version; post a bug report in the forum. When it is fixed in QM, it is not automatically fixed in QM-created exe files; need to rebuild them with the new QM version.


Web browsers (and other apps) have bugs in their accessible object implementations. For example, can give incorrect locations of some objects. Or you cannot capture some objects because they are "behind" bigger objects; then try to capture two times: at first capture normally, then check 'Capture smallest' in the Drag tool's right-click menu, and capture again.


There are two alternatives, often faster:


When none of the above works, use scan (find image).


In current Opera versions everything is the same as in Chrome.

Java windows

QM 2.4.2. acc and Acc class functions support accessible objects in applications written in Java that don't use Windows controls, including OpenOffice, LibreOffice, NetBeans, jEdit and Java in Control Panel.


Prerequisites (except OpenOffice and LibreOffice):


To enable JAB, run function JavaEnableJAB (once on a computer/account). Or run jabswitch.exe -enable. Or enable in Control Panel -> Ease of access (not on XP). Then restart Java applications. When installing Java, may need to restart QM too.


Current OpenOffice and LibreOffice versions don't use JAB. For older versions need JAB, and also check: Options -> Accessibility -> Support assistive technology tools.


If only 64-bit Java is installed, JAB does not work by default because of missing file C:\Windows\SysWOW64\WindowsAccessBridge-32.dll. To fix it, also install 32-bit Java (it coexists with 64-bit Java). Or somewhere get WindowsAccessBridge-32.dll and put in SysWOW64 or QM folder. Only JAB 2.0.2 (old version) can be downloaded seperately from Java.


Some JAB features are unstable. Getting focused object often stops working. Getting object at x y does not work in some windows. To capture objects in such windows, in dialog 'Find accessible object' right click the Drag image and check 'Capture smallest'.


QM does not implement accessible object triggers in Java windows that use JAB.