Platforms to show: All Mac Windows Linux Cross-Platform

Back to AccessibilityMBS module.

AccessibilityMBS.ApplicationAXUIElement(pid as Integer) as AXUIElementMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The AXUIElement for the current application.

AccessibilityMBS.Available as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
True if the Accessibility API is available.

Should always be true on Mac OS X 10.2.

AccessibilityMBS.IsProcessTrusted(Prompt as Boolean = false) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 13.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns whether the current process is a trusted accessibility client.

Added prompt flag for version 18.1.

Some examples using this method:

AccessibilityMBS.MakeAXValue(theCFObject as CFObjectMBS) as AXValueMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an AXValue object containing the CFObject.

Actually only the RB object around the cfobject handle is replaced.
You can't do this using a cast in RB, so this function was created.

AccessibilityMBS.MakeAXValueFromCFRange(location as Integer, length as Integer) as AXValueMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 13.5 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an AXValue object for a CFRange structure with the given values.
Example
// create with values and read them back
Var a as AXValueMBS = AccessibilityMBS.MakeAXValueFromCFRange(5, 9)

if a.AXIsCFRange then
Var lo, le as Integer

if a.AXGetCFRange(lo, le) then
MsgBox str(lo)+" "+str(le)
else
break // error
end if
else
break // error
end if

AccessibilityMBS.MakeAXValueFromCGPoint(x as single, y as single) as AXValueMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an AXValue object for a CGPoint structure with the given values.

AccessibilityMBS.MakeAXValueFromCGRect(x as single, y as single, width as single, height as single) as AXValueMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an AXValue object for a CGRect structure with the given values.

AccessibilityMBS.MakeAXValueFromCGSize(width as single, height as single) as AXValueMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an AXValue object for a CGSize structure with the given values.

AccessibilityMBS.MakeProcessTrusted(path as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 13.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Attempts to make the process represented by the specified path a trusted accessibility client.

Use this function to make a process a trusted accessibility client.
Note: The caller must be running as root to successfully call this function. In addition, the caller should relaunch the process after this function returns successfully for the trusted status to take effect.

Path: The path to the executable of the process to make trusted.

Returns an error code that indicates success or failure.

AccessibilityMBS.SystemWideAXUIElement as AXUIElementMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Accessibility MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a AXUIElement which covers the whole system.
Example
// displays the current window title if accessibility is enabled in Mac OS X 10.2 or newer
// your application needs permissions for accessibility to make this work!

Var SystemWideElement,FocusedApplicationElement,FocusedWindowElement as AXUIElementMBS
Var FocusedApplication,FocusedWindow,Title as AXValueMBS
Var s as String
Var cs as CFStringMBS

// show a window so there is one which can be found
window1.show

SystemWideElement=AccessibilityMBS.SystemWideAXUIElement
if SystemWideElement<>nil then
FocusedApplication=SystemWideElement.AttributeValue(AccessibilityMBS.kAXFocusedApplicationAttribute)
if FocusedApplication.Type=AccessibilityMBS.kAXUIElementMBSTypeID then
FocusedApplicationElement=new AXUIElementMBS
FocusedApplicationElement.Handle=FocusedApplication.Handle
FocusedApplicationElement.RetainObject

FocusedWindow=FocusedApplicationElement.AttributeValue(AccessibilityMBS.kAXFocusedWindowAttribute)

if FocusedWindow<>nil and AccessibilityMBS.kAXUIElementMBSTypeID=FocusedWindow.Type then

FocusedWindowElement=new AXUIElementMBS
FocusedWindowElement.Handle=FocusedWindow.Handle
FocusedWindowElement.RetainObject

Title=FocusedWindowElement.AttributeValue(AccessibilityMBS.kAXTitleAttribute)
if Title<>nil and Title.Type=kCFStringMBSTypeID then
cs=new CFStringMBS
cs.handle=Title.Handle
cs.RetainObject
msgbox cs.str
end if
end if
end if
end if

In the current implementation you can use this to get the AXUIElement for the frontmost application.

Some examples using this method:

The items on this page are in the following plugins: MBS MacCF Plugin.


The biggest plugin in space...