Accessibility API

The accessibility API enables text selection and editing more powerful than what Dragon provides natively, to a wider range of applications (e.g. Google Chrome and Mozilla Firefox). It is currently in Beta and the API may change at any time. To use this API on Windows, install pyia2 (currently needs to be cloned and added to PYTHONPATH; I have a pending pull request to fix this). To use this with Chrome, you may also need an additional 64-bit IAccessible2 DLL which can be obtained here.

Entry points

get_accessibility_controller()[source]

Get the OS-independent accessibility controller which is the gateway to all accessibility functionality.

get_stopping_accessibility_controller(*args, **kwds)[source]

Same as get_accessibility_controller(), but automatically stops when used in a with context.

Controller class

class AccessibilityController(os_controller)[source]

OS-independent controller for accessing accessibility functionality.

is_editable_focused()[source]

True if an editable text field is focused.

move_cursor(text_query, position)[source]

Moves the cursor before or after text that matches the provided query.

replace_text(text_query, replacement)[source]

Replaces text which matches the provided query.

select_text(text_query)[source]

Selects text which matches the provided query.

stop()[source]

Stops the controller (otherwise process exit may be blocked).

TextQuery class

class TextQuery(start_phrase='', start_relative_position=None, start_relative_phrase='', through=False, end_phrase='', end_relative_position=None, end_relative_phrase='')[source]

A query to match a range of text.

end_phrase = None

The phrase at the end of the match (or the sole phrase).

end_relative_phrase = None

The phrase to match before or after at the end.

end_relative_position = None

Whether to match before or after the end_relative_phrase.

start_phrase = None

The phrase at the start of the match.

start_relative_phrase = None

The phrase to match before or after at the start.

start_relative_position = None

Whether to match before or after the start_relative_phrase.

through = None

True if matching from a start point to the end phrase.

CursorPosition class

class CursorPosition[source]

The cursor position relative to a range of text.

AFTER = 2

The position after the text.

BEFORE = 1

The position before the text.