#
cp.ui.axutils
Utility functions to support hs.axuielement
.
#
Submodules
#
API Overview
Functions - API calls offered directly by the extension
cache childAtIndex childFromBottom childFromLeft childFromRight childFromTop childInColumn childIndex childMatching children childrenAbove childrenBelow childrenInColumn childrenInLine childrenInNextLine childrenMatching childrenWith childrenWithRole childWith childWithDescription childWithID childWithRole childWithTitle hasAttributeValue hasChild isValid prop snapshot valueOf withAttributeValue withRole withTitle withValue
#
API Documentation
#
Functions
#
cache
Signature | cp.ui.axutils.cache(source, key, finderFn[, verifyFn]) -> axuielement |
Type | Function |
Description | Checks if the cached value at the source[key] is a valid axuielement. If not it will call the provided finderFn() function (with no arguments), cache the result and return it. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 654 |
#
childAtIndex
Signature | cp.ui.axutils.childAtIndex(element, index, compareFn[, matcherFn]) -> axuielement |
Type | Function |
Description | Searches for the child element which is at number index when sorted using the compareFn . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 385 |
#
childFromBottom
Signature | cp.ui.axutils.childFromBottom(element, index, matcherFn) -> axuielement |
Type | Function |
Description | Searches for the child element which is at number index when sorted bottom-to-top. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 528 |
#
childFromLeft
Signature | cp.ui.axutils.childFromLeft(element, index[, matcherFn]) -> axuielement |
Type | Function |
Description | Searches for the child element which is at number index when sorted left-to-right. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 483 |
#
childFromRight
Signature | cp.ui.axutils.childFromRight(element, index[, matcherFn]) -> axuielement |
Type | Function |
Description | Searches for the child element which is at number index when sorted right-to-left. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 498 |
#
childFromTop
Signature | cp.ui.axutils.childFromTop(element, index[, matcherFn]) -> axuielement |
Type | Function |
Description | Searches for the child element which is at number index when sorted top-to-bottom. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 513 |
#
childInColumn
Signature | cp.ui.axutils.childInColumn(element, role, startIndex, childIndex) -> table | nil |
Type | Function |
Description | Finds the children for an element, then checks to see if they match the supplied role. It then compares the vertical position data of all matching children and returns an element defined by the childIndex , which lines up vertially with the element defined by the startIndex . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 133 |
#
childIndex
Signature | cp.ui.axutils.childIndex(element) -> number or nil |
Type | Function |
Description | Finds the index of the specified child element, if it is present. If not, nil is returned. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 603 |
#
childMatching
Signature | cp.ui.axutils.childMatching(element, matcherFn[, index]) -> axuielement |
Type | Function |
Description | This searches for the first child of the specified element for which the provided function returns true . The function will receive one parameter - the current child. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 354 |
#
children
Signature | cp.ui.axutils.children(element[, compareFn]) -> table |
Type | Function |
Description | Finds the children for the element. If it is an hs.axuielement , it will attempt to get the AXChildren attribute. If it is a table with a children function, that will get called. If no children exist, an empty table will be returned. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 149 |
#
childrenAbove
Signature | cp.ui.axutils.childrenAbove(element, bottomElement) -> table of axuielement or nil |
Type | Function |
Description | Finds the list of axuielement children from the element which are above the specified bottomElement . If the element is nil , nil is returned. If the topElement is nil all children are returned. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 197 |
#
childrenBelow
Signature | cp.ui.axutils.childrenBelow(element, topElement) -> table of axuielement or nil |
Type | Function |
Description | Finds the list of axuielement children from the element which are below the specified topElement . If the element is nil , nil is returned. If the topElement is nil all children are returned. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 183 |
#
childrenInColumn
Signature | cp.ui.axutils.childrenInColumn(element, role, startIndex) -> table | nil |
Type | Function |
Description | Finds the children for an element, then checks to see if they match the supplied role. It then compares the vertical position data of all matching children and returns a table with only the elements that line up to the element defined by the startIndex. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 93 |
#
childrenInLine
Signature | cp.ui.axutils.childrenInLine(element) -> table | nil |
Type | Function |
Description | Gets a table of children that are all in the same family and line as the supplied element. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 39 |
#
childrenInNextLine
Signature | cp.ui.axutils.childrenInNextLine(element) -> table | nil |
Type | Function |
Description | Gets a table of children that are in the next line in relation to the supplied element. Scrollbars will be ignored. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 65 |
#
childrenMatching
Signature | cp.ui.axutils.childrenMatching(element, matcherFn) -> { axuielement } |
Type | Function |
Description | This searches for all children of the specified element for which the provided function returns true . The function will receive one parameter - the current child. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 572 |
#
childrenWith
Signature | cp.ui.axutils.childrenWith(element, name, value) -> axuielement |
Type | Function |
Description | This searches for all children of the specified element which has an attribute with the matching name and value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 543 |
#
childrenWithRole
Signature | cp.ui.axutils.childrenWithRole(element, value) -> axuielement |
Type | Function |
Description | This searches for all children of the specified element which has an AXRole attribute with the matching value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 558 |
#
childWith
Signature | cp.ui.axutils.childWith(element, name, value) -> axuielement |
Type | Function |
Description | This searches for the first child of the specified element which has an attribute with the matching name and value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 283 |
#
childWithDescription
Signature | cp.ui.axutils.childWithDescription(element, value) -> axuielement |
Type | Function |
Description | This searches for the first child of the specified element which has AXDescription with the specified value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 340 |
#
childWithID
Signature | cp.ui.axutils.childWithID(element, value) -> axuielement |
Type | Function |
Description | This searches for the first child of the specified element which has AXIdentifier with the specified value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 298 |
#
childWithRole
Signature | cp.ui.axutils.childWithRole(element, value) -> axuielement |
Type | Function |
Description | This searches for the first child of the specified element which has AXRole with the specified value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 312 |
#
childWithTitle
Signature | cp.ui.axutils.childWithTitle(element, value) -> axuielement |
Type | Function |
Description | This searches for the first child of the specified element which has AXTitle with the specified value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 326 |
#
hasAttributeValue
Signature | cp.ui.axutils.hasAttributeValue(element, name, value) -> boolean |
Type | Function |
Description | Checks to see if an element has a specific value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 211 |
#
hasChild
Signature | cp.ui.axutils.hasChild(element, matcherFn) -> boolean |
Type | Function |
Description | Checks if the axuielement has a child that passes the matcherFn . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 589 |
#
isValid
Signature | cp.ui.axutils.isValid(element) -> boolean |
Type | Function |
Description | Checks if the axuilelement is still valid - that is, still active in the UI. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 624 |
#
prop
Signature | cp.ui.axutils.prop(uiFinder, attributeName[, settable]) -> cp.prop |
Type | Function |
Description | Creates a new cp.prop which will find the hs.axuielement via the uiFinder and get/set the value (if settable is true ). |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 761 |
#
snapshot
Signature | cp.ui.axutils.snapshot(element, filename, elementFrame) -> hs.image |
Type | Function |
Description | Takes a snapshot of the specified axuielement and returns it. If the filename is provided it also saves the file to the specified location. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 689 |
#
valueOf
Signature | cp.ui.axutils.valueOf(element, name[, default]) -> anything |
Type | Function |
Description | Returns the named AX attribute value, or the default if it is empty. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 22 |
#
withAttributeValue
Signature | cp.ui.axutils.withAttributeValue(element, name, value) -> hs.axuielement | nil |
Type | Function |
Description | Checks if the element has an attribute value with the specified name and value . If so, the element is returned, otherwise nil . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 226 |
#
withRole
Signature | cp.ui.axutils.withRole(element, role) -> hs.axuielement | nil |
Type | Function |
Description | Checks if the element has an "AXRole" attribute with the specified role . If so, the element is returned, otherwise nil . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 241 |
#
withTitle
Signature | cp.ui.axutils.withTitle(element, title) -> hs.axuielement | nil |
Type | Function |
Description | Checks if the element has an "AXTitle" attribute with the specified title . If so, the element is returned, otherwise nil . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 269 |
#
withValue
Signature | cp.ui.axutils.withValue(element, value) -> hs.axuielement | nil |
Type | Function |
Description | Checks if the element has an "AXValue" attribute with the specified value . If so, the element is returned, otherwise nil . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/axutils.lua line 255 |