UIAHandler package
- class UIAHandler.UIAHandler(*args, **kw)
Bases:
COMObject
- _com_interfaces_ = [<class 'comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.IUIAutomationEventHandler'>, <class 'comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.IUIAutomationFocusChangedEventHandler'>, <class 'comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.IUIAutomationPropertyChangedEventHandler'>, <class 'comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.IUIAutomationNotificationEventHandler'>, <class 'comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.IUIAutomationActiveTextPositionChangedEventHandler'>]
- _rateLimitedEventHandler: IUnknown | None = None
- _notificationKindsToNamesCache = {0: 'ItemAdded', 1: 'ItemRemoved', 2: 'ActionCompleted', 3: 'ActionAborted', 4: 'Other'}
A cache of UIA notification kinds to friendly names for logging
- getUIANotificationKindDebugString(notificationKind: int) str
Generates a string representation of the given UIA notification kind, suitable for logging. This is the name part of the NotificationKind_* constant. If a matching constant can not be found, then a string representation of the NotificationKind value itself is used. E.g. “unknown notification kind 1234”.
- _notificationProcessingValuesToNamesCache = {0: 'ImportantAll', 1: 'ImportantMostRecent', 2: 'All', 3: 'MostRecent', 4: 'CurrentThenMostRecent'}
A cache of UIA notification processing values to friendly names for logging
- getUIANotificationProcessingValueDebugString(notificationProcessing: int) str
Generates a string representation of the given UIA notification processing value, suitable for logging. This is the name part of the NotificationProcessing_* constant. If a matching constant can not be found, then a string representation of the NotificationProcessing value itself is used. E.g. “unknown notification processing value 1234”.
- getUIAPropertyIDDebugString(propertyID: int) str
Generates a string representation of the given property ID, suitable for logging. For constant or registered property IDs, the name is the programmatic name registered for the property in UIA. If no name can be found, then a string representation of the ID itself is used. E.g. “unknown property ID 1234”.
- _eventIDsToNamesCache = {20000: 'ToolTipOpened', 20001: 'ToolTipClosed', 20002: 'StructureChanged', 20003: 'MenuOpened', 20004: 'AutomationPropertyChanged', 20005: 'AutomationFocusChanged', 20006: 'AsyncContentLoaded', 20007: 'MenuClosed', 20008: 'LayoutInvalidated', 20009: 'Invoke_Invoked', 20010: 'SelectionItem_ElementAddedToSelection', 20011: 'SelectionItem_ElementRemovedFromSelection', 20012: 'SelectionItem_ElementSelected', 20013: 'Selection_Invalidated', 20014: 'Text_TextSelectionChanged', 20015: 'Text_TextChanged', 20016: 'Window_WindowOpened', 20017: 'Window_WindowClosed', 20018: 'MenuModeStart', 20019: 'MenuModeEnd', 20020: 'InputReachedTarget', 20021: 'InputReachedOtherElement', 20022: 'InputDiscarded', 20023: 'SystemAlert', 20024: 'LiveRegionChanged', 20025: 'HostedFragmentRootsInvalidated', 20026: 'Drag_DragStart', 20027: 'Drag_DragCancel', 20028: 'Drag_DragComplete', 20029: 'DropTarget_DragEnter', 20030: 'DropTarget_DragLeave', 20031: 'DropTarget_Dropped', 20032: 'TextEdit_TextChanged', 20033: 'TextEdit_ConversionTargetChanged', 20034: 'Changes', 20035: 'Notification', 20036: 'ActiveTextPositionChanged'}
A cache of UIA event IDs to friendly names for logging
- getUIAEventIDDebugString(eventID: int) str
Generates a string representation of the given UIA event ID, suitable for logging. This is the name part of the UIA_*EventId constant. If a matching constant can not be found, then a string representation of the ID itself is used. E.g. “unknown event ID 1234”.
- getUIAElementPropertyDebugString(element: IUIAutomationElement, propertyId: int) str
Fetches a property from a UIA element, for the specific purpose of logging. NULL value and exceptions are also given a string representation.
- getWindowHandleDebugString(windowHandle: int) str
Generates a string representation of the given window handle suitable for logging. Includes the handle value and the window’s class name.
- getUIAElementDebugString(element: IUIAutomationElement) str
Generates a string representation of the given UIA element suitable for logging. Including info such as name, controlType and automation Id.
- terminate()
- MTAThreadFunc()
- _registerGlobalEventHandlers(handler: UIAHandler)
- _createLocalEventHandlerGroup(handler: UIAHandler)
- addEventHandlerGroup(element, eventHandlerGroup)
- removeEventHandlerGroup(element, eventHandlerGroup)
- addLocalEventHandlerGroupToElement(element, isFocus=False)
- removeLocalEventHandlerGroupFromElement(element)
- IUIAutomationEventHandler_HandleAutomationEvent(sender, eventID)
- lastFocusedUIAElement = None
- IUIAutomationFocusChangedEventHandler_HandleFocusChangedEvent(sender)
- IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(sender, propertyId, newValue)
- IUIAutomationNotificationEventHandler_HandleNotificationEvent(sender, NotificationKind, NotificationProcessing, displayString, activityId)
- IUIAutomationActiveTextPositionChangedEventHandler_HandleActiveTextPositionChangedEvent(sender, textRange)
- _isUIAWindowHelper(hwnd: int, isDebug=False) bool
- isUIAWindow(hwnd: int, isDebug: bool = False) bool
- getNearestWindowHandle(UIAElement)
- _isNetUIEmbeddedInWordDoc(element: IUIAutomationElement) bool
Detects if the given UIA element represents a control in a NetUI container embedded within a MS Word document window. E.g. the Modern Comments side track pane. This method also caches the answer on the element itself to both speed up checking later and to allow checking on an already dead element E.g. a previous focus.
- _emitMSAAFocusForWordDocIfNecessary(element: IUIAutomationElement) None
Fires an MSAA focus event on the given UIA element if the element is the root of a Word document, and the focus was previously in a NetUI container embedded in this Word document.
- isNativeUIAElement(UIAElement)
- UIAHandler.initialize()
- UIAHandler.terminate()
- UIAHandler._isDebug()
Subpackages
- UIAHandler._remoteOps package
- Subpackages
- UIAHandler._remoteOps.instructions package
- Submodules
- UIAHandler._remoteOps.instructions._base module
- UIAHandler._remoteOps.instructions.arithmetic module
- UIAHandler._remoteOps.instructions.array module
- UIAHandler._remoteOps.instructions.bool module
- UIAHandler._remoteOps.instructions.controlFlow module
- UIAHandler._remoteOps.instructions.element module
- UIAHandler._remoteOps.instructions.extension module
- UIAHandler._remoteOps.instructions.float module
- UIAHandler._remoteOps.instructions.general module
- UIAHandler._remoteOps.instructions.guid module
- UIAHandler._remoteOps.instructions.int module
- UIAHandler._remoteOps.instructions.null module
- UIAHandler._remoteOps.instructions.status module
- UIAHandler._remoteOps.instructions.string module
- UIAHandler._remoteOps.instructions.textRange module
- UIAHandler._remoteOps.remoteTypes package
RemoteBaseObject
RemoteVariant
RemoteNull
RemoteIntegral
RemoteBool
RemoteNumber
RemoteIntBase
RemoteUint
RemoteInt
RemoteFloat
RemoteString
RemoteArray
RemoteGuid
getRemoteTypeForLocalType()
- Submodules
- UIAHandler._remoteOps.remoteTypes.element module
- UIAHandler._remoteOps.remoteTypes.extensionTarget module
- UIAHandler._remoteOps.remoteTypes.intEnum module
- UIAHandler._remoteOps.remoteTypes.textRange module
- UIAHandler._remoteOps.instructions package
- Submodules
- UIAHandler._remoteOps.builder module
_RemoteBase
Operand
InstructionBase
GenericInstruction
InstructionList
InstructionList._modified
InstructionList._byteCodeCache
InstructionList._all
InstructionList._instructions
InstructionList._addItem()
InstructionList.addComment()
InstructionList.addInstruction()
InstructionList.addGenericInstruction()
InstructionList.addMetaCommand()
InstructionList.getByteCode()
InstructionList.getInstruction()
InstructionList.getInstructionCount()
InstructionList.iterItems()
InstructionList.dumpInstructions()
InstructionList.clear()
RemoteOperationBuilder
RemoteOperationBuilder._versionBytes
RemoteOperationBuilder._sectionNames
RemoteOperationBuilder._lastOperandIdRequested
RemoteOperationBuilder._defaultSection
RemoteOperationBuilder.lastOperandIdRequested
RemoteOperationBuilder.requestNewOperandId()
RemoteOperationBuilder.getInstructionList()
RemoteOperationBuilder.getDefaultInstructionList()
RemoteOperationBuilder.overrideDefaultSection()
RemoteOperationBuilder.getAllInstructions()
RemoteOperationBuilder.getByteCode()
RemoteOperationBuilder.dumpInstructions()
- UIAHandler._remoteOps.localExecute module
LocalExecutionResult
HaltException
BreakLoopException
BadOperationStatusException
InstructionLimitExceededException
LocalOperationResultSet
LocalExecutor
LocalExecutor._operationStatus
LocalExecutor._instructions
LocalExecutor._ip
LocalExecutor._instructionLoopDepth
LocalExecutor._instructionCounter
LocalExecutor._maxInstructions
LocalExecutor._registers
LocalExecutor._requestedResults
LocalExecutor.operationStatus
LocalExecutor.storeRegisterValue()
LocalExecutor.fetchRegisterValue()
LocalExecutor._operationStatusFromException()
LocalExecutor._execute_ForkIfFalse()
LocalExecutor._execute_NewLoopBlock()
LocalExecutor._execute_NewTryBlock()
LocalExecutor._execute_ContinueLoop()
LocalExecutor._execute_SetOperationStatus()
LocalExecutor._execute_GetOperationStatus()
LocalExecutor._executeInstruction()
LocalExecutor._instructionLoop()
LocalExecutor.importElement()
LocalExecutor.importTextRange()
LocalExecutor.addToResults()
LocalExecutor.loadInstructions()
LocalExecutor.execute()
- UIAHandler._remoteOps.lowLevel module
OperandId
RelativeOffset
RemoteOperationResultSet
RemoteOperation
RemoteOperationStatus
InstructionType
InstructionType.Nop
InstructionType.Set
InstructionType.ForkIfTrue
InstructionType.ForkIfFalse
InstructionType.Fork
InstructionType.Halt
InstructionType.NewLoopBlock
InstructionType.EndLoopBlock
InstructionType.BreakLoop
InstructionType.ContinueLoop
InstructionType.NewTryBlock
InstructionType.EndTryBlock
InstructionType.SetOperationStatus
InstructionType.GetOperationStatus
InstructionType.Add
InstructionType.Subtract
InstructionType.Multiply
InstructionType.Divide
InstructionType.BinaryAdd
InstructionType.BinarySubtract
InstructionType.BinaryMultiply
InstructionType.BinaryDivide
InstructionType.InPlaceBoolNot
InstructionType.InPlaceBoolAnd
InstructionType.InPlaceBoolOr
InstructionType.BoolNot
InstructionType.BoolAnd
InstructionType.BoolOr
InstructionType.Compare
InstructionType.NewInt
InstructionType.NewUint
InstructionType.NewBool
InstructionType.NewDouble
InstructionType.NewChar
InstructionType.NewString
InstructionType.NewPoint
InstructionType.NewRect
InstructionType.NewArray
InstructionType.NewStringMap
InstructionType.NewNull
InstructionType.GetPointProperty
InstructionType.GetRectProperty
InstructionType.RemoteArrayAppend
InstructionType.RemoteArraySetAt
InstructionType.RemoteArrayRemoveAt
InstructionType.RemoteArrayGetAt
InstructionType.RemoteArraySize
InstructionType.RemoteStringMapInsert
InstructionType.RemoteStringMapRemove
InstructionType.RemoteStringMapHasKey
InstructionType.RemoteStringMapLookup
InstructionType.RemoteStringMapSize
InstructionType.RemoteStringGetAt
InstructionType.RemoteStringSubstr
InstructionType.RemoteStringConcat
InstructionType.RemoteStringSize
InstructionType.GetPropertyValue
InstructionType.Navigate
InstructionType.IsNull
InstructionType.IsNotSupported
InstructionType.IsMixedAttribute
InstructionType.IsBool
InstructionType.IsInt
InstructionType.IsUint
InstructionType.IsDouble
InstructionType.IsChar
InstructionType.IsString
InstructionType.IsPoint
InstructionType.IsRect
InstructionType.IsArray
InstructionType.IsStringMap
InstructionType.IsElement
InstructionType.NewGuid
InstructionType.IsGuid
InstructionType.LookupId
InstructionType.LookupGuid
InstructionType.NewCacheRequest
InstructionType.IsCacheRequest
InstructionType.CacheRequestAddProperty
InstructionType.CacheRequestAddPattern
InstructionType.PopulateCache
InstructionType.Stringify
InstructionType.GetMetadataValue
InstructionType.CallExtension
InstructionType.IsExtensionSupported
InstructionType.TextRangeClone
InstructionType.TextRangeCompare
InstructionType.TextRangeCompareEndpoints
InstructionType.TextRangeExpandToEnclosingUnit
InstructionType.TextRangeFindAttribute
InstructionType.TextRangeFindText
InstructionType.TextRangeGetAttributeValue
InstructionType.TextRangeGetBoundingRectangles
InstructionType.TextRangeGetEnclosingElement
InstructionType.TextRangeGetText
InstructionType.TextRangeMove
InstructionType.TextRangeMoveEndpointByUnit
InstructionType.TextRangeMoveEndpointByRange
InstructionType.TextRangeSelect
InstructionType.TextRangeAddToSelection
InstructionType.TextRangeRemoveFromSelection
InstructionType.TextRangeScrollIntoView
InstructionType.TextRangeGetChildren
InstructionType.TextRangeShowContextMenu
ComparisonType
NavigationDirection
TextUnit
TextPatternRangeEndpoint
PropertyId
PropertyId.LiveSetting
PropertyId.IsTransformPattern2Available
PropertyId.IsSpreadsheetItemPatternAvailable
PropertyId.Transform2CanZoom
PropertyId.IsDockPatternAvailable
PropertyId.IsGridItemPatternAvailable
PropertyId.IsExpandCollapsePatternAvailable
PropertyId.IsTextPattern2Available
PropertyId.StylesExtendedProperties
PropertyId.IsTextChildPatternAvailable
PropertyId.SpreadsheetItemFormula
PropertyId.IsDragPatternAvailable
PropertyId.DragIsGrabbed
PropertyId.AnnotationAnnotationTypeName
PropertyId.DragDropEffect
PropertyId.DragDropEffects
PropertyId.IsDropTargetPatternAvailable
PropertyId.OutlineColor
PropertyId.ItemStatus
PropertyId.DropTargetDropTargetEffect
PropertyId.DropTargetDropTargetEffects
PropertyId.IsObjectModelPatternAvailable
PropertyId.DragGrabbedItems
PropertyId.Transform2ZoomLevel
PropertyId.Transform2ZoomMinimum
PropertyId.AcceleratorKey
PropertyId.IsTextEditPatternAvailable
PropertyId.FlowsFrom
PropertyId.HasKeyboardFocus
PropertyId.IsPeripheral
PropertyId.Transform2ZoomMaximum
PropertyId.IsCustomNavigationPatternAvailable
PropertyId.AnnotationAuthor
PropertyId.IsSelectionItemPatternAvailable
PropertyId.ClassName
PropertyId.PositionInSet
PropertyId.SizeOfSet
PropertyId.Level
PropertyId.AnnotationTypes
PropertyId.AnnotationDateTime
PropertyId.AnnotationObjects
PropertyId.Name
PropertyId.IsScrollItemPatternAvailable
PropertyId.IsTableItemPatternAvailable
PropertyId.LandmarkType
PropertyId.IsRangeValuePatternAvailable
PropertyId.LocalizedLandmarkType
PropertyId.IsScrollPatternAvailable
PropertyId.FullDescription
PropertyId.IsSelectionPatternAvailable
PropertyId.IsTablePatternAvailable
PropertyId.SpreadsheetItemAnnotationObjects
PropertyId.AnnotationTarget
PropertyId.IsAnnotationPatternAvailable
PropertyId.FillColor
PropertyId.FillType
PropertyId.VisualEffects
PropertyId.OutlineThickness
PropertyId.CenterPoint
PropertyId.Rotation
PropertyId.Size
PropertyId.IsSelectionPattern2Available
PropertyId.Selection2FirstSelectedItem
PropertyId.Selection2LastSelectedItem
PropertyId.Selection2CurrentSelectedItem
PropertyId.Selection2ItemCount
PropertyId.HeadingLevel
PropertyId.IsDialog
PropertyId.DockDockPosition
PropertyId.IsTextPatternAvailable
PropertyId.IsTogglePatternAvailable
PropertyId.IsTransformPatternAvailable
PropertyId.IsValuePatternAvailable
PropertyId.IsWindowPatternAvailable
PropertyId.ValueValue
PropertyId.ValueIsReadOnly
PropertyId.RangeValueValue
PropertyId.RangeValueIsReadOnly
PropertyId.RangeValueMinimum
PropertyId.RangeValueMaximum
PropertyId.RangeValueLargeChange
PropertyId.RangeValueSmallChange
PropertyId.ScrollHorizontalScrollPercent
PropertyId.ScrollHorizontalViewSize
PropertyId.ScrollVerticalScrollPercent
PropertyId.ScrollVerticalViewSize
PropertyId.ScrollHorizontallyScrollable
PropertyId.ScrollVerticallyScrollable
PropertyId.SelectionSelection
PropertyId.SelectionCanSelectMultiple
PropertyId.SelectionIsSelectionRequired
PropertyId.GridRowCount
PropertyId.GridColumnCount
PropertyId.GridItemRow
PropertyId.GridItemColumn
PropertyId.GridItemRowSpan
PropertyId.GridItemColumnSpan
PropertyId.GridItemContainingGrid
PropertyId.ExpandCollapseExpandCollapseState
PropertyId.MultipleViewSupportedViews
PropertyId.MultipleViewCurrentView
PropertyId.AnnotationAnnotationTypeId
PropertyId.Culture
PropertyId.IsRequiredForForm
PropertyId.LegacyIAccessibleSelection
PropertyId.AriaRole
PropertyId.ItemType
PropertyId.LegacyIAccessibleKeyboardShortcut
PropertyId.LegacyIAccessibleDefaultAction
PropertyId.LegacyIAccessibleDescription
PropertyId.LegacyIAccessibleHelp
PropertyId.TableItemRowHeaderItems
PropertyId.TableItemColumnHeaderItems
PropertyId.LegacyIAccessibleState
PropertyId.ToggleToggleState
PropertyId.TransformCanMove
PropertyId.LabeledBy
PropertyId.NativeWindowHandle
PropertyId.IsPassword
PropertyId.HelpText
PropertyId.IsContentElement
PropertyId.IsControlElement
PropertyId.FrameworkId
PropertyId.Orientation
PropertyId.ClickablePoint
PropertyId.TransformCanRotate
PropertyId.IsLegacyIAccessiblePatternAvailable
PropertyId.LegacyIAccessibleValue
PropertyId.LegacyIAccessibleChildId
PropertyId.LegacyIAccessibleName
PropertyId.LegacyIAccessibleRole
PropertyId.TransformCanResize
PropertyId.IsOffscreen
PropertyId.IsSpreadsheetPatternAvailable
PropertyId.ControllerFor
PropertyId.IsEnabled
PropertyId.IsItemContainerPatternAvailable
PropertyId.OptimizeForVisualContent
PropertyId.IsSynchronizedInputPatternAvailable
PropertyId.IsVirtualizedItemPatternAvailable
PropertyId.IsInvokePatternAvailable
PropertyId.IsMultipleViewPatternAvailable
PropertyId.IsKeyboardFocusable
PropertyId.FlowsTo
PropertyId.AccessKey
PropertyId.AutomationId
PropertyId.ProcessId
PropertyId.SpreadsheetItemAnnotationTypes
PropertyId.IsDataValidForForm
PropertyId.ProviderDescription
PropertyId.StylesStyleId
PropertyId.BoundingRectangle
PropertyId.RuntimeId
PropertyId.DescribedBy
PropertyId.ControlType
PropertyId.IsGridPatternAvailable
PropertyId.StylesFillPatternColor
PropertyId.StylesFillPatternStyle
PropertyId.LocalizedControlType
PropertyId.StylesStyleName
PropertyId.StylesFillColor
PropertyId.AriaProperties
PropertyId.StylesShape
PropertyId.IsStylesPatternAvailable
PropertyId.WindowIsModal
PropertyId.TableRowHeaders
PropertyId.WindowWindowVisualState
PropertyId.SelectionItemIsSelected
PropertyId.TableColumnHeaders
PropertyId.WindowCanMinimize
PropertyId.TableRowOrColumnMajor
PropertyId.WindowWindowInteractionState
PropertyId.WindowCanMaximize
PropertyId.WindowIsTopmost
PropertyId.SelectionItemSelectionContainer
AttributeId
AttributeId.BackgroundColor
AttributeId.BulletStyle
AttributeId.StrikethroughColor
AttributeId.ForegroundColor
AttributeId.UnderlineStyle
AttributeId.AnnotationObjects
AttributeId.CapStyle
AttributeId.Culture
AttributeId.FontName
AttributeId.FontSize
AttributeId.FontWeight
AttributeId.HorizontalTextAlignment
AttributeId.Tabs
AttributeId.TextFlowDirections
AttributeId.UnderlineColor
AttributeId.IndentationFirstLine
AttributeId.IsReadOnly
AttributeId.IndentationLeading
AttributeId.IndentationTrailing
AttributeId.IsHidden
AttributeId.StrikethroughStyle
AttributeId.IsItalic
AttributeId.IsSubscript
AttributeId.IsSuperscript
AttributeId.MarginBottom
AttributeId.MarginLeading
AttributeId.MarginTop
AttributeId.MarginTrailing
AttributeId.OutlineStyles
AttributeId.OverlineColor
AttributeId.OverlineStyle
AttributeId.AnnotationTypes
AttributeId.StyleName
AttributeId.StyleId
AttributeId.Link
AttributeId.IsActive
AttributeId.SelectionActiveEnd
AttributeId.CaretPosition
AttributeId.CaretBidiMode
AttributeId.LineSpacing
AttributeId.BeforeParagraphSpacing
AttributeId.AfterParagraphSpacing
AttributeId.SayAsInterpretAs
AttributeId.AnimationStyle
StyleId
- UIAHandler._remoteOps.operation module
ExecutionResult
Executor
OperationException
ExecutionFailureException
MalformedBytecodeException
InstructionLimitExceededException
UnhandledException
NoReturnException
RemoteExecutionResult
RemoteExecutor
Operation
Operation._remoteLog
Operation._returnIdOperand
Operation._yieldListOperand
Operation._built
Operation._executionCount
Operation._compiletimeLoggingEnabled
Operation._runtimeLoggingEnabled
Operation._executorClass
Operation._rob
Operation._importedElements
Operation._importedTextRanges
Operation._requestedResults
Operation._staticOperands
Operation.importElement()
Operation.importTextRange()
Operation.addToResults()
Operation._registerStaticOperand()
Operation._refreshStaticInstructions()
Operation.buildContext()
Operation.buildFunction()
Operation.buildIterableFunction()
Operation._execute()
Operation._dumpRemoteLog()
Operation._dumpCompiletimeLog()
Operation._executeUntilSuccess()
Operation.execute()
Operation.iterExecute()
- UIAHandler._remoteOps.remoteAPI module
RemoteAPI
RemoteAPI._rob
RemoteAPI._op
RemoteAPI._logObj
RemoteAPI.Return()
RemoteAPI.Yield()
RemoteAPI._newObject_RemoteType
RemoteAPI._newObject()
RemoteAPI.newUint()
RemoteAPI.newInt()
RemoteAPI.newFloat()
RemoteAPI.newString()
RemoteAPI.newBool()
RemoteAPI.newGuid()
RemoteAPI.newVariant()
RemoteAPI.newArray()
RemoteAPI.newElement()
RemoteAPI.newTextRange()
RemoteAPI.getOperationStatus()
RemoteAPI.setOperationStatus()
RemoteAPI._scopeInstructionJustExited
RemoteAPI.ifBlock()
RemoteAPI.elseBlock()
RemoteAPI.continueLoop()
RemoteAPI.breakLoop()
RemoteAPI.whileBlock()
RemoteAPI._range_intTypeVar
RemoteAPI.forEachNumInRange()
RemoteAPI.forEachItemInArray()
RemoteAPI.tryBlock()
RemoteAPI.catchBlock()
RemoteAPI.halt()
RemoteAPI.logRuntimeMessage()
RemoteAPI.getLogObject()
RemoteAPI.addCompiletimeComment()
- UIAHandler._remoteOps.remoteAlgorithms module
- UIAHandler._remoteOps.remoteFuncWrapper module
- Subpackages
Submodules
UIAHandler.browseMode module
Bases:
DocumentWithTableNavigation
Starting from the given start position, Locates the table cell with the given row and column coordinates and table ID. @param startPos: the position to start searching from. @type startPos: L{textInfos.TextInfo} @param tableID: the ID of the table. @param row: the row number of the cell @type row: int @param column: the column number of the table cell @type column: int @returns: the table cell’s position in the document @rtype: L{textInfos.TextInfo} @raises: LookupError if the cell does not exist
Bases:
TextInfoQuickNavItem
See L{QuickNavItem.__init__} for itemType and document argument definitions. @param textInfo: the textInfo position this item represents. @type textInfo: L{textInfos.TextInfo}
Bases:
TextInfoQuickNavItem
See L{QuickNavItem.__init__} for itemType and document argument definitions. @param textInfo: the textInfo position this item represents. @type textInfo: L{textInfos.TextInfo}
a UIA text attribute to search for
A set of attribute values acceptable to match the search.
Bases:
TextAttribUIATextInfoQuickNavItem
See L{QuickNavItem.__init__} for itemType and document argument definitions. @param textInfo: the textInfo position this item represents. @type textInfo: L{textInfos.TextInfo}
a UIA text attribute to search for
A set of attribute values acceptable to match the search.
Bases:
TextInfoQuickNavItem
See L{QuickNavItem.__init__} for itemType and document argument definitions. @param textInfo: the textInfo position this item represents. @type textInfo: L{textInfos.TextInfo}
Is this item a child of the given parent? This is used when representing items in a hierarchical tree structure, such as the Elements List. @param parent: the item of whom this item may be a child of. @type parent: L{QuickNavItem} @return: True if this item is a child, false otherwise. @rtype: bool
- class UIAHandler.browseMode.UIABrowseModeDocumentTextInfo(*args, **kwargs)
Bases:
BrowseModeDocumentTextInfo
,RootProxyTextInfo
Constructor. Subclasses must extend this, calling the superclass method first. @param position: The initial position of this range; one of the POSITION_* constants or a position object supported by the implementation. @param obj: The object containing the range of text being represented.
- _get_UIAElementAtStart()
- UIAElementAtStart
- _abc_impl = <_abc._abc_data object>
- class UIAHandler.browseMode.UIABrowseModeDocument(*args, **kwargs)
Bases:
UIADocumentWithTableNavigation
,BrowseModeDocumentTreeInterceptor
- TextInfo
alias of
UIABrowseModeDocumentTextInfo
- shouldRememberCaretPositionAcrossLoads = False
- _nativeAppSelectionMode: bool = True
Whether native selection mode is turned on or off
- event_UIA_activeTextPositionChanged(obj, nextHandler, textRange=None)
- _iterNodesByType(nodeType, direction='next', pos=None)
Yields L{QuickNavItem} objects representing the ordered positions in this document according to the type being searched for (e.g. link, heading, table etc). @param itemType: the type being searched for (e.g. link, heading, table etc) @type itemType: string @param direction: the direction in which to search (next, previous, up) @type direction: string @param pos: the position in the document from where to start the search. @type pos: Usually an L{textInfos.TextInfo} @raise NotImplementedError: This type is not supported by this BrowseMode implementation
- _get_isAlive()
Whether this interceptor is alive. If it is not alive, it will be removed.
- _abc_impl = <_abc._abc_data object>
- isAlive
UIAHandler.constants module
- class UIAHandler.constants.FillType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- NONE = 0
- COLOR = 1
- GRADIENT = 2
- PICTURE = 3
- PATTERN = 4
- class UIAHandler.constants.UIAutomationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- INT = 1
- BOOL = 2
- STRING = 3
- DOUBLE = 4
- POINT = 5
- RECT = 6
- ELEMENT = 7
- ARRAY = 8
- OUT = 9
- INT_ARRAY = 10
- BOOL_ARRAY = 11
- STRING_ARRAY = 12
- DOUBLE_ARRAY = 13
- POINT_ARRAY = 14
- RECT_ARRAY = 15
- ELEMENT_ARRAY = 16
- OUT_INT = 17
- OUT_BOOL = 18
- OUT_STRING = 19
- OUT_DOUBLE = 20
- OUT_POINT = 21
- OUT_RECT = 22
- OUT_ELEMENT = 23
- OUT_INT_ARRAY = 24
- OUT_BOOL_ARRAY = 25
- OUT_STRING_ARRAY = 26
- OUT_DOUBLE_ARRAY = 27
- OUT_POINT_ARRAY = 28
- OUT_RECT_ARRAY = 29
- OUT_ELEMENT_ARRAY = 30
UIAHandler.customAnnotations module
This module provides helpers and a common format to define UIA custom annotation types. The common custom annotation types are defined here. Custom annotation types specific to an application should be defined within a NVDAObjects/UIA submodule specific to that application, E.G. ‘NVDAObjects/UIA/excel.py’
UIA originally had hard coded ‘static’ ID’s for annotation types.
For an example see ‘AnnotationType_SpellingError’ in
source/comInterfaces/_944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.py
imported via UIAutomationClient.py
.
When a new annotation type was added the UIA spec had to be updated.
Now a mechanism is in place to allow applications to register “custom annotation types”.
This relies on both the UIA server application and the UIA client application sharing a known
GUID for the annotation type.
- class UIAHandler.customAnnotations.CustomAnnotationTypeInfo(guid: GUID)
Bases:
object
Holds information about a CustomAnnotationType This makes it easy to define custom annotation types to be loaded.
- guid: GUID
- _registeredAnnotations: ClassVar[Dict[GUID, int]] = {}
- _registerCustomAnnotation() int
Registers the annotation with a given GUID.
A GUID uniquely identifies a custom annotation, but the UIA system relies on integer IDs. Any application (clients or providers) can register a custom annotation type, subsequent applications will get the same id for a given GUID. Registering custom annotations is only supported on Windows 11 and above. For any lesser version, id will be 0.
- property id: int
Return an ID for a given annotation registering it first if necessary.
Id’s of all registered annotations are cached when requested for the first time to prevent unnecessary work by repeatedly interacting with UIA .
- class UIAHandler.customAnnotations.CustomAnnotationTypesCommon
Bases:
object
UIA ‘custom annotation types’ common to all applications. Once registered, all subsequent registrations will return the same ID value.
UIAHandler.customProps module
This module provides helpers and a common format to define UIA custom properties. The common custom properties are defined here. Custom properties specific to an application should be defined within a NVDAObjects/UIA submodule specific to that application, E.G. ‘NVDAObjects/UIA/excel.py’
UIA originally had hard coded ‘static’ ID’s for properties.
For an example see ‘UIA_SelectionPatternId’ in
source/comInterfaces/_944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.py
imported via UIAutomationClient.py
.
When a new property was added the UIA spec had to be updated.
Now a mechanism is in place to allow applications to register “custom properties”.
This relies on both the UIA server application and the UIA client application sharing a known
GUID for the property.
- class UIAHandler.customProps.CustomPropertyInfo(guid: GUID, programmaticName: str, uiaType: UIAutomationType)
Bases:
object
Holds information about a CustomProperty This makes it easy to define custom properties to be loaded.
- guid: GUID
- programmaticName: str
- uiaType: UIAutomationType
- _registeredProperties: ClassVar[Dict[GUID, int]] = {}
- _registerCustomProperty() int
Registers a custom property with a given id.
UIA will return the id to use when given the GUID. Any application can be first to register a custom property, subsequent applications will be given the same id.
- property id: int
Return the integer id of the given property registering it first if necessary.
Id’s of all registered properties are cached when requested for the first time to prevent unnecessary work by repeatedly interacting with UIA.
- class UIAHandler.customProps.CustomPropertiesCommon
Bases:
object
UIA ‘custom properties’ common to all applications. Once registered, all subsequent registrations will return the same ID value.
UIAHandler.remote module
- UIAHandler.remote.isSupported() bool
Returns whether UIA remote operations are supported on this version of Windows.
- UIAHandler.remote.initialize(doRemote: bool, UIAClient: IUIAutomation)
Initializes UI Automation remote operations. The following parameters are deprecated and ignored: @param doRemote: true if code should be executed remotely, or false for locally. @param UIAClient: the current instance of the UI Automation client library running in NVDA.
- UIAHandler.remote.terminate()
Terminates UIA remote operations support.
- UIAHandler.remote.msWord_getCustomAttributeValue(docElement: IUIAutomationElement, textRange: IUIAutomationTextRange, customAttribID: int) Any | None
- UIAHandler.remote.collectAllHeadingsInTextRange(textRange: IUIAutomationTextRange) Generator[tuple[int, str, IUIAutomationElement], None, None]
- UIAHandler.remote.findFirstHeadingInTextRange(textRange: IUIAutomationTextRange, wantedLevel: int | None = None, reverse: bool = False) tuple[int, str, IUIAutomationElement] | None
UIAHandler.types module
- class UIAHandler.types._IUIAutomationTextRangeT(*args, **kwargs)
Bases:
Protocol
- clone() IUIAutomationTextRangeT
- compare(other: IUIAutomationTextRangeT) bool
- CompareEndpoints(source: int, rangeObject: IUIAutomationTextRangeT, target: int) int
- ExpandToEnclosingUnit(unit: int) None
- findText() IUIAutomationTextRangeT
- GetBoundingRectangles() List
- getText(index: int) str
- Move(unit: int, direction: int) None
- MoveEndpointByRange(source: int, rangeObject: IUIAutomationTextRangeT, target: int) None
- MoveEndpointByUnit(endPoint: int, unit: int, direction: int) None
- Select() None
- _abc_impl = <_abc._abc_data object>
- _is_protocol = True
- class UIAHandler.types.IUIAutomationTextRangeT(name, bases, namespace)
Bases:
_cominterface_meta
,_IUIAutomationTextRangeT
- _abc_impl = <_abc._abc_data object>
- _is_protocol = False
UIAHandler.utils module
- UIAHandler.utils.createUIAMultiPropertyCondition(*dicts)
A helper function that Creates a complex UI Automation Condition matching on various UI Automation properties with both ‘and’ and ‘or’. Arguments to this function are dicts whos keys are UI Automation property IDs, and whos values are a list of possible values for the property ID. The dicts are joined with ‘or’, the keys in each dict are joined with ‘and’, and the values for each key are joined with ‘or’. For example, to create a condition that matches on a controlType of button or edit and where isReadOnly is True, or, className is ‘ding’, you would provide arguments of: {UIA_ControlTypePropertyId:[UIA_ButtonControlTypeId,UIA_EditControlTypeId],UIA_Value_ValueIsReadOnly:[True]},{UIA_ClassNamePropertyId:[‘ding’]}
- UIAHandler.utils.UIATextRangeFromElement(documentTextPattern, element)
Wraps IUIAutomationTextRange::getEnclosingElement, returning None on COMError.
- UIAHandler.utils.isUIAElementInWalker(element, walker)
Checks if the given IUIAutomationElement exists in the given IUIAutomationTreeWalker by calling IUIAutomationTreeWalker::normalizeElement and comparing the fetched element with the given element.
- UIAHandler.utils.getDeepestLastChildUIAElementInWalker(element, walker)
Starting from the given IUIAutomationElement, walks to the deepest last child of the given IUIAutomationTreeWalker.
- exception UIAHandler.utils.UIAMixedAttributeError
Bases:
ValueError
Raised when a function would return a UIAutomation text attribute value that is mixed.
- UIAHandler.utils.getUIATextAttributeValueFromRange(rangeObj, attrib, ignoreMixedValues=False)
Wraps IUIAutomationTextRange::getAttributeValue, returning UIAutomation’s reservedNotSupportedValue on COMError, and raising UIAMixedAttributeError if a mixed value would be returned and ignoreMixedValues is False.
- UIAHandler.utils.iterUIARangeByUnit(rangeObj, unit, reverse=False)
Splits a given UI Automation text range into smaller text ranges the size of the given unit and yields them. @param rangeObj: the UI Automation text range to split. @type rangeObj: L{UIAHandler.IUIAutomationTextRange} @param unit: a UI Automation text unit. @param reverse: true if the range should be walked backwards (from end to start) @type reverse: bool @rtype: a generator that yields L{UIAHandler.IUIAutomationTextRange} objects.
- UIAHandler.utils.getEnclosingElementWithCacheFromUIATextRange(textRange, cacheRequest)
A thin wrapper around IUIAutomationTextRange3::getEnclosingElementBuildCache if it exists, otherwise IUIAutomationTextRange::getEnclosingElement and then IUIAutomationElement::buildUpdatedCache.
- class UIAHandler.utils.CacheableUIAElementArray(elementArray, cacheRequest=None)
Bases:
object
- property length
- getElement(index)
- UIAHandler.utils.getChildrenWithCacheFromUIATextRange(textRange, cacheRequest)
A thin wrapper around IUIAutomationTextRange3::getChildrenBuildCache if it exists, otherwise IUIAutomationTextRange::getChildren but wraps the result in an object that automatically calls IUIAutomationElement::buildUpdateCache on any element retreaved.
- UIAHandler.utils.isTextRangeOffscreen(textRange, visiRanges)
Given a UIA text range and a visible textRanges array (returned from obj.UIATextPattern.GetVisibleRanges), determines if the given textRange is not within the visible textRanges.
- class UIAHandler.utils.UIATextRangeAttributeValueFetcher(textRange)
Bases:
object
- getValue(ID, ignoreMixedValues=False)
- class UIAHandler.utils.BulkUIATextRangeAttributeValueFetcher(textRange, IDs)
Bases:
UIATextRangeAttributeValueFetcher
- getValue(ID, ignoreMixedValues=False)
- class UIAHandler.utils.FakeEventHandlerGroup(clientObject)
Bases:
object
Mimics the behavior of UiAutomation 6+ Event Handler Groups for older versions.
- property clientObject
- AddAutomationEventHandler(eventId, scope, cacheRequest, handler)
- AddNotificationEventHandler(scope, cacheRequest, handler)
- AddPropertyChangedEventHandler(scope, cacheRequest, handler, propertyArray, propertyCount)
- registerToClientObject(element)
- unregisterFromClientObject(element)
- UIAHandler.utils._shouldUseUIAConsole(hwnd: int) bool
Determines whether to use UIA in the Windows Console.
- UIAHandler.utils._getConhostAPILevel(hwnd: int) WinConsoleAPILevel
This function determines which of several console UIA workarounds are needed in a given conhost instance. See the comments on the WinConsoleAPILevel enum for details.
- UIAHandler.utils._shouldSelectivelyRegister() bool
Determines whether to register for UIA events selectively or globally.
- UIAHandler.utils._shouldUseWindowsTerminalNotifications() bool
Determines whether to use notifications for new text reporting in Windows Terminal.
- UIAHandler.utils._isFrameworkIdWinForm(hwnd: int) bool
Returns whether this window belongs to an element that originates from the Windows Forms framework (WinForm). This is used to determine whether a native UIA implementation should be used for SysListView32 controls.