#cp.fn.ax
A collection of useful functions for working with AX.
You may also find functions in cp.fn and cp.fn.table useful.
#API Overview
Functions - API calls offered directly by the extension
- areAligned
- attribute
- bottomToTop
- bottomUp
- cache
- childMatching
- children
- childrenMatching
- childrenTopDown
- childWith
- hasAttributeValue
- hasRole
- init
- initElements
- isUIElement
- isValid
- leftToRight
- matchesIf
- narrowToWide
- performAction
- prop
- rightToLeft
- setAttribute
- shortToTall
- topDown
- topToBottom
- topToBottomBaseAligned
- uielement
- uielementList
#API Documentation
#Functions
Signature | cp.fn.ax.areAligned(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is aligned with element b . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 205 |
Signature | cp.fn.ax.attribute(name) -> function(uivalue) -> any | nil |
Type | Function |
Description | Returns a function which will return the AX value of the given name from the given value . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 118 |
Signature | cp.fn.ax.bottomToTop(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is below element b . May be used with table.sort . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 426 |
Signature | cp.fn.ax.bottomUp(a, b) -> boolean |
Type | Function |
Description | The reverse of topDown , ordering from linearly from bottom-to-top, right-to-left |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 519 |
Signature | cp.fn.ax.cache(source, key, finderFn, [verifyFn]) -> cachedValue |
Type | Function |
Description | A combinator which 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/fn/ax.lua line 158 |
Signature | cp.fn.ax.childMatching(predicate[, index][, comparator]) -> function(uivalue) -> axuielement | nil |
Type | Function |
Description | Returns a function that will return the first child of the given uivalue that matches the given predicate . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 274 |
Signature | cp.fn.ax.children(value) -> table | nil |
Type | Function |
Description | Returns the children of the given value . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 232 |
Signature | cp.fn.ax.childrenMatching(predicate[, comparator]) -> table of axuielement | nil |
Type | Function |
Description | Returns the children of the given uivalue that match the given predicate . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 259 |
Signature | cp.fn.ax.childrenTopDown(value) -> table | nil |
Type | Function |
Description | Returns the children of the given value sorted in topDown order. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 629 |
Signature | cp.fn.ax.childWith(attribute, value) -> function(uivalue) -> axuielement | nil |
Type | Function |
Description | Returns a function that will return the first child of the given uivalue that has the given attribute set to value . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 296 |
Signature | cp.fn.ax.hasAttributeValue(attribute, value) -> function(uivalue) -> boolean |
Type | Function |
Description | Returns a function that returns true if the given uivalue has the given attribute set to the value . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 327 |
Signature | cp.fn.ax.hasRole(role) -> function(uivalue) -> boolean |
Type | Function |
Description | Returns a function that returns true if the given uivalue has the given AXRole . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 347 |
Signature | cp.fn.ax.init(elementType, ...) -> function(parent, uiFinder) -> cp.ui.Element |
Type | Function |
Description | Creates a function that will create a new cp.ui.Element of the given elementType with the given parent and uiFinder . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 533 |
Signature | cp.fn.ax.initElements(parent, elementsUiFinder, elementInits) -> table of cp.ui.Element |
Type | Function |
Description | Creates a table of cp.ui.Element s of the given elementInits with the given parent and uiFinder . Any additional elements provided by elementsUiFinder which don't have a matching elementInits will be ignored. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 568 |
Signature | cp.fn.ax.isUIElement(value) -> boolean |
Type | Function |
Description | Checks to see if the value is an axuielement |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 28 |
Signature | cp.fn.ax.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/fn/ax.lua line 358 |
Signature | cp.fn.ax.leftToRight(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is left of element b . May be used with table.sort . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 378 |
Signature | cp.fn.ax.matchesIf(...) -> function(value) -> boolean |
Type | Function |
Description | Creates a function which will return true if the value is either an axuielement , an Element, or a callable (function) that returns an axuielement that matches the predicate. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 609 |
Signature | cp.fn.ax.narrowToWide(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is narrower than element b . May be used with table.sort . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 468 |
Signature | cp.fn.ax.performAction(action) -> function(uivalue) -> axuielement | false | nil, errString |
Type | Function |
Description | Performs the given action on the given uivalue . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 308 |
Signature | cp.fn.ax.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/fn/ax.lua line 587 |
Signature | cp.fn.ax.rightToLeft(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is right of element b . May be used with table.sort . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 394 |
Signature | cp.fn.ax.setAttribute(name) -> function(newValue, uivalue) -> nil |
Type | Function |
Description | Returns a function which will set the AX value of uivalue (if present) the given name from the given value . If the uivalue is not present, it will not attempt to set the new value. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 137 |
Signature | cp.fn.ax.shortToTall(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is shorter than element b . May be used with table.sort . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 484 |
Signature | cp.fn.ax.topDown(a, b) -> boolean |
Type | Function |
Description | Compares two axuielement values, ordering them linearly, from top-to-bottom, left-to-right. See the Notes section for more information. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 500 |
Signature | cp.fn.ax.topToBottom(a, b) -> boolean |
Type | Function |
Description | Returns true if element a is above element b . May be used with table.sort . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 410 |
Signature | cp.fn.ax.topToBottomBaseAligned(a, b) -> boolean |
Type | Function |
Description | Returns true if the base of element a is above the base of element b , based on linear vertical alignment. May be used with table.sort . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 442 |
Signature | cp.fn.ax.uielement(uivalue) -> axuielement | nil |
Type | Function |
Description | Returns the axuielement for the given uivalue . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 41 |
Signature | cp.fn.ax.uielementList(value) -> table of axuielement | nil |
Type | Function |
Description | Returns the axuielement list for the given value , if available. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/fn/ax.lua line 69 |