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 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])
Example:
---- 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 a.DoDefaultAction ...
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)
There are 2 ways to capture an object:
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 Search -> In Reverse Order.
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.
Accessible objects in web pages are supported in Internet Explorer and Firefox. Partially in Chrome (if started with command line --force-renderer-accessibility) and Opera.
Some web browsers not always properly support object capturing. You cannot capture some smaller objects because they are "behind" bigger objects. Then try to capture two times. At first capture normally, then check 'Capture smallest' and capture again. Some object locations are incorrect.
There are two faster alternatives. With Internet Explorer and IE-based browsers you can use function htm (find html element). With Firefox and Chrome try to check 'as Firefox node' in the 'Find accessible object' dialog.