public class AXUIElement
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
copyActionNames(AXUIElementRef element)
Returns a list of all the actions the specified accessibility object can perform.
|
java.lang.String[] |
copyAttributeNames(AXUIElementRef element)
Returns a list of all the attributes supported by the specified accessibility object.
|
java.lang.Object |
copyAttributeValue(AXUIElementRef element,
java.lang.String attribute)
Returns the value of an accessibility object's attribute.
|
java.lang.Object[] |
copyAttributeValues(AXUIElementRef element,
java.lang.String attribute,
int index,
int maxValues)
Returns an array of attribute values for the accessibility object's attribute,
starting at the specified index.
|
AXUIElementRef |
copyElementAtPosition(AXUIElementRef application,
java.awt.Point position)
Returns the accessibility object at the specified position in top-left relative screen
coordinates.
|
AXUIElementRef |
createSystemWide()
Returns an accessibility object that provides access to system attributes.
|
int |
getAttributeValueCount(AXUIElementRef element,
java.lang.String attribute)
Returns the count of the array of an accessibility object's attribute value.
|
static AXUIElement |
getInstance() |
boolean |
isAPIEnabled()
Returns whether the accessibility API is enabled.
|
boolean |
isAttributeSettable(AXUIElementRef element,
java.lang.String attribute)
Returns whether the specified accessibility object's attribute can be modified.
|
boolean |
isCurrentProcessTrusted()
Returns whether the current process is a trusted accessibility client.
|
void |
makeProcessTrusted(java.lang.String executablePath)
Attempts to make the process represented by the specified path a trusted accessibility
client.
|
public static AXUIElement getInstance()
public boolean isAPIEnabled()
Assistive applications will not work if the accessibility API is not enabled or if the calling process is not a trusted accessibility client. Users can enable the accessibility API by checking "Enable access for assistive devices" in Universal Access Preferences.
public boolean isCurrentProcessTrusted()
public void makeProcessTrusted(java.lang.String executablePath)
Use this function to make a process a trusted accessibility client. Note: The caller must be running as root to successfully call this function.
executablePath
- The path to the executable of the process to make trusted.public AXUIElementRef createSystemWide()
This is useful for things like finding the focused accessibility object regardless of which application is currently active.
public AXUIElementRef copyElementAtPosition(AXUIElementRef application, java.awt.Point position)
This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location. Note that if the system-wide accessibility object is passed in the application parameter, the position test is not restricted to a particular application.
application
- The AXUIElementRef representing the application that contains the
screen coordinates (or the system-wide accessibility object).position
- The position.public java.lang.String[] copyActionNames(AXUIElementRef element)
element
- The AXUIElementRef representing the accessibility object.public java.lang.String[] copyAttributeNames(AXUIElementRef element)
element
- The AXUIElementRef representing the accessibility object.public java.lang.Object copyAttributeValue(AXUIElementRef element, java.lang.String attribute)
element
- The AXUIElementRef representing the accessibility object.attribute
- The attribute name.public java.lang.Object[] copyAttributeValues(AXUIElementRef element, java.lang.String attribute, int index, int maxValues)
This function is useful for dealing with large arrays, for example, a table view with a large number of children.
element
- The AXUIElementRef representing the accessibility object.attribute
- The attribute name.index
- The index into the array.maxValues
- The maximum number of values you want (this may be more or less than
the number of values associated with the attribute).public int getAttributeValueCount(AXUIElementRef element, java.lang.String attribute)
element
- The AXUIElementRef representing the accessibility object.attribute
- The attribute name.public boolean isAttributeSettable(AXUIElementRef element, java.lang.String attribute)
element
- The AXUIElementRef representing the accessibility object.attribute
- The attribute name.