Skip to content

03. UIA main class

Descolada edited this page Jun 13, 2025 · 11 revisions

UIA interface/class is the main object of the UIA.ahk library. It is the starting point that we use to access elements, interact with some general UIA properties, create conditions, TreeWalkers, add event handlers and more.

Initialization

UIA is initialized on the first use of the UIA class, for example with UIA.ElementFromHandle. By default the highest available version of IUIAutomation is initialized, which depends on your Windows version: for Windows 11 it's usually version 7. To limit UIA to a certain IUIAutomation version (so the script would run properly on older Windows versions), change the IUIAutomationMaxVersion global variable before using UIA. The running version of UIA is stored in UIA.IUIAutomationVersion.

Here are the Windows versions where IUIAutomation versions are available:

  • IUIAutomation : Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista, Windows XP with SP3 and Platform Update for Windows Vista
  • IUIAutomation2 : Windows 8
  • IUIAutomation3 : Windows 8.1
  • IUIAutomation4 : Windows 10, version 1607
  • IUIAutomation5 : Windows 10, version 1607
  • IUIAutomation6 : Windows 10, version 1809

Screen reader

By default UIA activates a global "screen reader" state, which signals applications that an accessibility program is being used to read text off the screen. This is because some applications such as Visual Studio Code do not activate UIAutomation nor respond to it if that state is not enabled. To avoid that the screen reader mode is enabled automatically at the first encounter of the UIA class, either the #include or an UIA.Element... call. However, since some applications may render their content differently because of this, it may be wanted to avoid it. To do that set the global IUIAutomationActivateScreenReader variable to false or 0 before any use of UIA. For example

global IUIAutomationActivateScreenReader := 0
#include <UIA>

The current screen reader state may be queried using UIA.GetScreenReader() and changed using UIA.SetScreenReader(NewState).

Customizing UIA version and DLL

It's also possible to load and use a custom UIAutomationCore.dll to use a specific UIA DLL version, which might affect what elements in the UIA tree are shown and can standardize script functioning. To do that we can set the global IUIAutomationDllPath variable to the DLL path, and it needs to be located in the code before the UIA #include directive and also before any use of the UIA class. Example:

IUIAutomationDllPath := "C:\Windows\System32\UIAutomationCore.dll"

#include UIA.ahk
MsgBox UIA.ElementFromHandle("A").Dump()

The used IUIAutomation version can be limited to a specific one by setting the global IUIAutomationMaxVersion variable in the same manner, for example IUIAutomationMaxVersion := 1 limits UIA to the first version instead of the latest one.

UIA object

UIAutomation interface exposes methods that enable us to discover, access, and filter UI Automation elements. The members of this interface are not specific to a particular element.

Properties

  • IUIAutomationMaxVersion : currently running version
  • TrueCondition : contains a True condition
  • TreeWalkerTrue : contains a TreeWalker created with the True condition
  • ControlViewWalker : see TreeWalkers section
  • ContentViewWalker : see TreeWalkers section
  • RawViewWalker : see TreeWalkers section
  • RawViewCondition : see Conditions section
  • ControlViewCondition : see Conditions section
  • ContentViewCondition : see Conditions section
  • ProxyFactoryMapping
  • ReservedNotSupportedValue
  • ReservedMixedAttributeValue

IUIAutomation2 properties [available from Windows 8 forward]

  • AutoSetFocus : specifies whether calls to UI Automation control pattern methods automatically set focus to the target element. Default is True. This property can be get and set.
  • ConnectionTimeout : specifies the length of time that UI Automation will wait for a provider to respond to a client request for an automation element. Default is 20000ms (20 seconds), minimum seems to be 50ms. This property can be get and set.
  • TransactionTimeout : specifies the length of time that UI Automation will wait for a provider to respond to a client request for information about an automation element. Default is 2000ms (2 seconds), minimum seems to be 50ms. This property can be get and set.

IUIAutomation6 properties [available from Windows 10 version 1809 forward]

  • ConnectionRecoveryBehavior : indicates whether an accessible technology client adjusts provider request timeouts when the provider is non-responsive.
  • CoalesceEvents : gets or sets whether an accessible technology client receives all events, or a subset where duplicate events are detected and filtered.

Enumerations

The UIA class also contains a number of values that can be used as arguments for methods. These can be accessed as UIA.Enumeration.Name or getting the name from the value as UIA.Enumeration[Value]. For example, UIA.ControlType.Button is the value 50000, whereas UIA.ControlType[50000] is equal to the string Button. In most cases you can just use the enumeration name when it's required, and the library uses the correct enumeration automatically: for example UIA.CreateCondition("Type", "Button") replaces "Type" with "UIA.Property.ControlType" value and "Button" with "UIA.ControlType.Button" value. If enumerations need to be combined, then this can be done with the pipe "|" operator: UIA.TreeScope.Family == UIA.TreeScope.Element | UIA.TreeScope.Children

ControlType

These are all the different types that elements can be. The type of element also determines what properties and patterns are available to it. For example, a button usually has InvokePattern available; a CheckBox has TogglePattern available, and ToggleState.

Button, Calendar, CheckBox, ComboBox, Edit, Hyperlink, Image, ListItem, List, Menu, MenuBar, MenuItem, ProgressBar, RadioButton, ScrollBar, Slider, Spinner, StatusBar, Tab, TabItem, Text, ToolBar, ToolTip, Tree, TreeItem, Custom, Group, Thumb, DataGrid, DataItem, Document, SplitButton, Window, Pane, Header, HeaderItem, Table, TitleBar, Separator, SemanticZoom, AppBar

Property

Property names can be used to access element properties. Element.Name will return the Name property for the element.

RuntimeId, BoundingRectangle, ProcessId, ControlType (short form: Type), LocalizedControlType, Name, AcceleratorKey, AccessKey, HasKeyboardFocus, IsKeyboardFocusable, IsEnabled, AutomationId, ClassName, HelpText, ClickablePoint, Culture, IsControlElement, IsContentElement, LabeledBy, IsPassword, NativeWindowHandle, ItemType, IsOffscreen, Orientation, FrameworkId, IsRequiredForForm, ItemStatus, IsDockPatternAvailable, IsExpandCollapsePatternAvailable, IsGridItemPatternAvailable, IsGridPatternAvailable, IsInvokePatternAvailable, IsMultipleViewPatternAvailable, IsRangeValuePatternAvailable, IsScrollPatternAvailable, IsScrollItemPatternAvailable, IsSelectionItemPatternAvailable, IsSelectionPatternAvailable, IsTablePatternAvailable, IsTableItemPatternAvailable, IsTextPatternAvailable, IsTogglePatternAvailable, IsTransformPatternAvailable, IsValuePatternAvailable, IsWindowPatternAvailable, ValueValue, Value, ValueIsReadOnly, RangeValueValue, RangeValueIsReadOnly, RangeValueMinimum, RangeValueMaximum, RangeValueLargeChange, RangeValueSmallChange, ScrollHorizontalScrollPercent, ScrollHorizontalViewSize, ScrollVerticalScrollPercent, ScrollVerticalViewSize, ScrollHorizontallyScrollable, ScrollVerticallyScrollable, SelectionSelection, SelectionCanSelectMultiple, SelectionIsSelectionRequired, GridRowCount, GridColumnCount, GridItemRow, GridItemColumn, GridItemRowSpan, GridItemColumnSpan, GridItemContainingGrid, DockDockPosition, ExpandCollapseExpandCollapseState, MultipleViewCurrentView, MultipleViewSupportedViews, WindowCanMaximize, WindowCanMinimize, WindowWindowVisualState, WindowWindowInteractionState, WindowIsModal, WindowIsTopmost, SelectionItemIsSelected, SelectionItemSelectionContainer, TableRowHeaders, TableColumnHeaders, TableRowOrColumnMajor, TableItemRowHeaderItems, TableItemColumnHeaderItems, ToggleToggleState, TransformCanMove, TransformCanResize, TransformCanRotate, IsLegacyIAccessiblePatternAvailable, LegacyIAccessibleChildId, LegacyIAccessibleName, LegacyIAccessibleValue, LegacyIAccessibleDescription, LegacyIAccessibleRole, LegacyIAccessibleState, LegacyIAccessibleHelp, LegacyIAccessibleKeyboardShortcut, LegacyIAccessibleSelection, LegacyIAccessibleDefaultAction, AriaRole, AriaProperties, IsDataValidForForm, ControllerFor, DescribedBy, FlowsTo, ProviderDescription, IsItemContainerPatternAvailable, IsVirtualizedItemPatternAvailable, IsSynchronizedInputPatternAvailable, OptimizeForVisualContent, IsObjectModelPatternAvailable, AnnotationAnnotationTypeId, AnnotationAnnotationTypeName, AnnotationAuthor, AnnotationDateTime, AnnotationTarget, IsAnnotationPatternAvailable, IsTextPattern2Available, StylesStyleId, StylesStyleName, StylesFillColor, StylesFillPatternStyle, StylesShape, StylesFillPatternColor, StylesExtendedProperties, IsStylesPatternAvailable, IsSpreadsheetPatternAvailable, SpreadsheetItemFormula, SpreadsheetItemAnnotationObjects, SpreadsheetItemAnnotationTypes, IsSpreadsheetItemPatternAvailable, Transform2CanZoom, IsTransformPattern2Available, LiveSetting, IsTextChildPatternAvailable, IsDragPatternAvailable, DragIsGrabbed, DragDropEffect, DragDropEffects, IsDropTargetPatternAvailable, DropTargetDropTargetEffect, DropTargetDropTargetEffects, DragGrabbedItems, Transform2ZoomLevel, Transform2ZoomMinimum, Transform2ZoomMaximum, FlowsFrom, IsTextEditPatternAvailable, IsPeripheral, IsCustomNavigationPatternAvailable, PositionInSet, SizeOfSet, Level, AnnotationTypes, AnnotationObjects, LandmarkType, LocalizedLandmarkType, FullDescription, FillColor, OutlineColor, FillType, VisualEffects, OutlineThickness, CenterPoint, Rotation, Size, IsSelectionPattern2Available, Selection2FirstSelectedItem, Selection2LastSelectedItem, Selection2CurrentSelectedItem, Selection2ItemCount, IsDialog

There are a few custom properties (which means they cannot be used with Find methods):

Location, Exists, Children, Parent

Pattern

Determines what kind of specialized methods and properties the element has depending on its type. See Patterns section in this Wiki for more information.

Invoke, Selection, Value, RangeValue, Scroll, ExpandCollapse, Grid, GridItem, MultipleView, Window, SelectionItem, Dock, Table, TableItem, Text, Toggle, Transform, ScrollItem, LegacyIAccessible, ItemContainer, VirtualizedItem, SynchronizedInput, ObjectModel, Annotation, Styles, Spreadsheet, SpreadsheetItem, TextChild, Drag, DropTarget, TextEdit, CustomNavigation

Event

Events can be registered to an event handler to detect changes in the user interface.

ToolTipOpened, ToolTipClosed, StructureChanged, MenuOpened, AutomationPropertyChanged, AutomationFocusChanged, AsyncContentLoaded, MenuClosed, LayoutInvalidated, Invoke_Invoked, SelectionItem_ElementAddedToSelection, SelectionItem_ElementRemovedFromSelection, SelectionItem_ElementSelected, Selection_Invalidated, Text_TextSelectionChanged, Text_TextChanged, Window_WindowOpened, Window_WindowClosed, MenuModeStart, MenuModeEnd, InputReachedTarget, InputReachedOtherElement, InputDiscarded, SystemAlert, LiveRegionChanged, HostedFragmentRootsInvalidated, Drag_DragStart, Drag_DragCancel, Drag_DragComplete, DropTarget_DragEnter, DropTarget_DragLeave, DropTarget_Dropped, TextEdit_TextChanged, TextEdit_ConversionTargetChanged, Changes, Notification, ActiveTextPositionChanged

TreeScope

Used in Find methods to determine the scope of the search.

None Element : only the element itself Children : direct children Family : element and direct children Descendants : children and their subtrees Subtree : the element itself, its children, and their subtrees Parent : not used Ancestors : not used

MatchMode

Used in conditions to change the matching mode of string values. By default the match mode for FindElement(s) methods is Exact, so only exact matches are found.

StartsWith, Substring, Exact, RegEx

TreeTraversalOptions

Can be used to customize tree navigation order in FindElement(s) methods.

Default, PostOrder, LastToFirstOrder

List of other enumerations

TextAttribute: format and style properties (text attributes) of textual content

AnimationStyle, BackgroundColor, BulletStyle, CapStyle, Culture, FontName, FontSize, FontWeight, ForegroundColor, HorizontalTextAlignment, IndentationFirstLine, IndentationLeading, IndentationTrailing, IsHidden, IsItalic, IsReadOnly, IsSubscript, IsSuperscript, MarginBottom, MarginLeading, MarginTop, MarginTrailing, OutlineStyles, OverlineColor, OverlineStyle, StrikethroughColor, StrikethroughStyle, Tabs, TextFlowDirections, UnderlineColor, UnderlineStyle, AnnotationTypes, AnnotationObjects, StyleName, StyleId, Link, IsActive, SelectionActiveEnd, CaretPosition, CaretBidiMode, LineSpacing, BeforeParagraphSpacing, AfterParagraphSpacing, SayAsInterpretAs AnnotationType Unknown, SpellingError, GrammarError, Comment, FormulaError, TrackChanges, Header, Footer, Highlighted, Endnote, Footnote, InsertionChange, DeletionChange, MoveChange, FormatChange, UnsyncedChange, EditingLockedChange, ExternalChange, ConflictingChange, Author, AdvancedProofingIssue, DataValidationError, CircularReferenceError, Mathematics Style Custom, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Heading7, Heading8, Heading9, Title, Subtitle, Normal, Emphasis, Quote, BulletedList, NumberedList LandmarkType Custom, Form, Main, Navigation, Search HeadingLevel None, 1, 2, 3, 4, 5, 6, 7, 8, 9 Change Summary Metadata SayAsInterpretAs AsyncContentLoadedState Beginning, Progress, Completed AutomationIdentifierType Property, Pattern, Event, ControlType, TextAttribute, LandmarkType, Annotation, Changes, Style ConditionType : type enumerations of IUIAutomation conditions True, False, Property, And, Or, Not EventArgsType Simple, PropertyChanged, StructureChanged, AsyncContentLoaded, WindowClosed, TextEditTextChanged, Changes, Notification, ActiveTextPositionChanged, StructuredMarkup AutomationElementMode None, Full CoalesceEventsOptions Disabled, Enabled ConnectionRecoveryBehaviorOptions Disabled, Enabled PropertyConditionFlags None, IgnoreCase, MatchSubstring ActiveEnd: Contains possible values for the SelectionActiveEnd text attribute, which indicates the location of the caret relative to a text range that represents the currently selected text. None, Start, End AnimationStyle: Contains values for the AnimationStyle text attribute. None, LasVegasLights, BlinkingBackground, SparkleText, MarchingBlackAnts, MarchingRedAnts, Shimmer, Other:-1 BulletStyle: Contains values for the BulletStyle text attribute. None, HollowRoundBullet, FilledRoundBullet, HollowSquareBullet, FilledSquareBullet, DashBullet, Other:-1 CapStyle: Contains values that specify the value of the CapStyle text attribute. None, SmallCap, AllCap, AllPetiteCaps, PetiteCaps, Unicase, Titling, Other:-1 CaretBidiMode: Contains possible values for the CaretBidiMode text attribute, which indicates whether the caret is in text that flows from left to right, or from right to left. LTR, RTL CaretPosition: Contains possible values for the CaretPosition text attribute, which indicates the location of the caret relative to a line of text in a text range. Unknown, EndOfLine, BeginningOfLine DockPosition: Contains values that specify the location of a docking window represented by the Dock control pattern. Top, Left, Bottom, Right, Fill, None ExpandCollapseState: Contains values that specify the state of a UI element that can be expanded and collapsed. Collapsed, Expanded, PartiallyExpanded, LeafNode FillType: Contains values for the FillType attribute. None, Color, Gradient, Picture, Pattern FlowDirection: Contains values for the TextFlowDirections text attribute. Default, RightToLeft, BottomToTop, Vertical LiveSetting: Contains possible values for the LiveSetting property. This property is implemented by provider elements that are part of a live region. Off, Polite, Assertive NavigateDirection: Contains values used to specify the direction of navigation within the Microsoft UI Automation tree. Parent, NextSibling, PreviousSibling, FirstChild, LastChild NotificationKind: Defines values that indicate the type of a notification event, and a hint to the listener about the processing of the event. ItemAdded, ItemRemoved, ActionCompleted, ActionAborted, Other NotificationProcessing: Defines values that indicate how a notification should be processed. ImportantAll, ImportantMostRecent, All, MostRecent, CurrentThenMostRecent OrientationType: Contains values that specify the orientation of a control. None, Horizontal, Vertical OutlineStyles: Contains values for the OutlineStyle text attribute. None, Outline, Shadow, Engraved, Embossed ProviderOptions ClientSideProvider, ServerSideProvider, NonClientAreaProvider, OverrideProvider, ProviderOwnsSetFocus, UseComThreading, RefuseNonClientSupport, HasNativeIAccessible, UseClientCoordinates RowOrColumnMajor: Contains values that specify whether data in a table should be read primarily by row or by column. RowMajor, ColumnMajor, Indeterminate SayAsInterpretAs: Defines the values that indicate how a text-to-speech engine should interpret specific data. None, Spell, Cardinal, Ordinal, Number, Date, Time, Telephone, Currency, Net, Url, Address, Name, Media, Date_MonthDayYear, Date_DayMonthYear, Date_YearMonthDay, Date_YearMonth, Date_MonthYear, Date_DayMonth, Date_MonthDay, Date_Year, Time_HoursMinutesSeconds12, Time_HoursMinutes12, Time_HoursMinutesSeconds24, Time_HoursMinutes24 ScrollAmount: Contains values that specify the direction and distance to scroll. LargeDecrement, SmallDecrement, NoAmount, LargeIncrement, SmallIncrement StructureChangeType: Contains values that specify the type of change in the Microsoft UI Automation tree structure. ChildAdded, ChildRemoved, ChildrenInvalidated, ChildrenBulkAdded, ChildrenBulkRemoved, ChildrenReordered SupportedTextSelection: Contains values that specify the supported text selection attribute. None, Single, Multiple SynchronizedInputType: Contains values that specify the type of synchronized input. KeyUp, KeyDown, LeftMouseUp, LeftMouseDown, RightMouseUp, RightMouseDown TextDecorationLineStyle: Contains values that specify the OverlineStyle, StrikethroughStyle, and UnderlineStyle text attributes. None, Single, WordsOnly, Double, Dot, Dash, DashDot, DashDotDot, Wavy, ThickSingle, DoubleWavy, ThickWavy, LongDash, ThickDash, ThickDashDot, ThickDashDotDot, ThickDot, ThickLongDash, Other:-1 TextEditChangeType: Describes the text editing change being performed by controls when text-edit events are raised or handled. None, AutoCorrect, Composition, CompositionFinalized, AutoComplete TextPatternRangeEndpoint: Contains values that specify the endpoints of a text range. Start, End TextUnit: Contains values that specify units of text for the purposes of navigation. Character, Format, Word, Line, Paragraph, Page, Document ToggleState: Contains values that specify the toggle state of a Microsoft UI Automation element that implements the Toggle control pattern. Off, On, Indeterminate ZoomUnit: Contains possible values for the IUIAutomationTransformPattern2::ZoomByUnit method, which zooms the viewport of a control by the specified unit. NoAmount, LargeDecrement, SmallDecrement, LargeIncrement, SmallIncrement WindowVisualState: Contains values that specify the visual state of a window. Normal, Maximized, Minimized WindowInteractionState: Contains values that specify the current state of the window for purposes of user interaction. Running, Closing, ReadyForUserInteraction, BlockedByModalWindow, NotResponding

Element accessing methods

GetRootElement

GetRootElement(cacheRequest:=0)

Retrieves the UI Automation element that represents the desktop. Optionally include a cache request (see Caching section in this Wiki)

ElementFromHandle

ElementFromHandle(hwnd:="", cacheRequest:=0, activateChromiumAccessibility:=500)

Retrieves a UI Automation element for the specified window. Additionally activateChromiumAccessibility flag is automatically set to 500, which means Chromium window accessibility will be automatically activated by sending the WM_GETOBJECT message, and a maximum of 500ms is waited until accessibility is activated. This will be done only once per window, further calls will not send the activation signal.

ElementFromChromium

ElementFromChromium(winTitle:="", activateChromiumAccessibility:=500, cacheRequest:=0)

Retrieves the Chromium element from a Chromium app (web-browser based applications such as Skype, Discord etc). activateChromiumAccessibility works the same as in ElementFromHandle.

ElementFromPoint

ElementFromPoint(x?, y?, cacheRequest:=0, activateChromiumAccessibility:=500)

Retrieves the UI Automation element at the specified point on the desktop, which isn't necessarily the deepest element under the point. Additionally activateChromiumAccessibility flag can be set to 0 to not activate accessibility in Chromium-based apps, otherwise it is the timeout period for Chromium activation. If activateChromiumAccessibility is supplied a VarRef then it will be set to the Chromium element.

GetFocusedElement

GetFocusedElement(cacheRequest:=0)

Retrieves the UI Automation element that has the input focus.

ElementFromIAccessible

UIA.ElementFromIAccessible(IAcc, childId:=0)

Gets an element from a MSAA/Acc object (the predecessor for UIA). This only works with Acc objects where the window natively implements IAccessible, which excludes most Win32 windows (like Notepad, Windows Explorer etc). The use of this method is discouraged, since UIA usually has more reliable ways of getting elements available.

For a more complete description for these, see the UIA tree section of this Wiki.

Condition methods

CreateTreeWalker

CreateTreeWalker(condition)

Retrieves a TreeWalker object that can be used to traverse the Microsoft UI Automation tree.

CreateCondition

CreateCondition(conditionObject)

Creates a new property condition from an object:

A single property condition consists of an object where the key is the property name, and value is the property value: {Name:"Test"} => Creates a condition where the Name property must match "Test" exactly

Everything inside {} is an "and" condition {Type:"Button", Name:"Something"} => Name must match "Something" AND ControlType must be Button

Everything inside [] is an "or" condition [{Name:"Test"}, {Name:"Something"}] Name must match "Test" OR Name must match "Something"

Object key "not" creates a not condition

matchmode key (short form: mm) can be one of UIA.MatchMode values (except StartsWith and RegEx) and defines the MatchMode Substring (value of 2) = can contain anywhere in string; Exact (value 3) = exact match

casesense key (short form: cs) defines case sensitivity (default: case-sensitive/True): True=case sensitive; False=case insensitive

CreateCondition

CreateCondition(property, value, flags?)

Creates a new property condition from a property name and value. It's recommended to use CreateCondition(conditionObject) instead.

CreateAndCondition

CreateAndCondition(c1,c2)

Combines two conditions with "and". It's recommended to use CreateCondition(conditionObject) instead.

CreateOrCondition

CreateOrCondition(c1,c2)

Combines two conditions with "or". It's recommended to use CreateCondition(conditionObject) instead.

CreateNotCondition

CreateNotCondition(c)

Creates a new "not" condition. It's recommended to use CreateCondition(conditionObject) instead.

For a more complete description for these, see the TreeWalker and Conditions sections in this Wiki.

Event methods

AddAutomationEventHandler

AddAutomationEventHandler(handler, element, eventId, scope:=0x4, cacheRequest:=0)

Registers a method that handles Microsoft UI Automation events. eventId must be an UIA.Event value. scope must be a TreeScope enum. cacheRequest can be specified is caching is used. handler is an event handler object, which can be created with UIA.CreateEventHandler function.

RemoveAutomationEventHandler

RemoveAutomationEventHandler(handler, element, eventId)

AddPropertyChangedEventHandler

AddPropertyChangedEventHandler(handler, element, propertyArray, scope:=0x4, cacheRequest:=0)

Registers a method that handles an array of property-changed events

RemovePropertyChangedEventHandler

RemovePropertyChangedEventHandler(handler, element)

AddStructureChangedEventHandler

AddStructureChangedEventHandler(handler, element, scope:=0x4, cacheRequest:=0)

RemoveStructureChangedEventHandler

RemoveStructureChangedEventHandler(handler, element)

AddFocusChangedEventHandler

AddFocusChangedEventHandler(handler, cacheRequest:=0)

RemoveFocusChangedEventHandler

RemoveFocusChangedEventHandler(handler)

RemoveAllEventHandlers

RemoveAllEventHandlers()

Removes all registered event handlers at once.

IUIAutomation3 event methods

AddTextEditTextChangedEventHandler

AddTextEditTextChangedEventHandler(handler, element, textEditChangeType, scope:=0x4, cacheRequest:=0)

RemoveTextEditTextChangedEventHandler

RemoveTextEditTextChangedEventHandler(handler, element)

IUIAutomation4 event methods

AddChangesEventHandler

AddChangesEventHandler(handler, element, scope, changeTypes, changesCount, cacheRequest:=0)

RemoveChangesEventHandler

RemoveChangesEventHandler(handler, element)

IUIAutomation5 event methods:

AddNotificationEventHandler

AddNotificationEventHandler(handler, element, scope:=0x4, cacheRequest:=0)

RemoveNotificationEventHandler

RemoveNotificationEventHandler(handler, element)

IUIAutomation6 event methods:

CreateEventHandlerGroup

CreateEventHandlerGroup()

AddEventHandlerGroup

AddEventHandlerGroup(handlerGroup, element)

RemoveEventHandlerGroup(handlerGroup, element)

AddActiveTextPositionChangedEventHandler

AddActiveTextPositionChangedEventHandler(handler, element, scope=0x4, cacheRequest:=0)

RemoveActiveTextPositionChangedEventHandler(handler, element)

Misc methods

RuntimeIdToString

RuntimeIdToString(runtimeId)

Converts a RuntimeId (array of integers) to a string.

RuntimeIdFromString

RuntimeIdFromString(str)

Converts a string-form RuntimeId back to a RuntimeId array

Filter

Filter(elementArray, function)

Filters elements from an element array if "function" evaluates to True

CreateCacheRequest

CreateCacheRequest(properties?, patterns?, scope?, mode?, filter?)

Creates a new cache request object (see Caching section in the Wiki) Optionally also initiate properties (an array of property names or ids), patterns (an array of pattern names or ids), TreeScope, AutomationElementMode, and TreeFilter (condition to cache only elements matching the condition).

CompareElements

CompareElements(e1,e2)

Checks if two elements are equal. Doing this the normal way with e1 == e2 will not work

CompareRuntimeIds

CompareRuntimeIds(r1,r2)

GetPropertyProgrammaticName

GetPropertyProgrammaticName(Id)

GetPatternProgrammaticName

GetPatternProgrammaticName(Id)

PollForPotentialSupportedPatterns

PollForPotentialSupportedPatterns(pElement, &patternIds, &patternNames)

Returns an object where keys are the names and values are the Ids

PollForPotentialSupportedProperties

PollForPotentialSupportedProperties(pElement, &propertyIds, &propertyNames)

Clone this wiki locally