Jump to content

UI Automation UDFs

Recommended Posts

To make it easier to maintain the UIA code, I've decided to split the code this way:

  • This new thread is used for the actual UIA UDFs. Ie. the files stored in Includes folders and named UIA_*.au3 or UIAEH_*.au3.
  • The UIASpy thread contains only code that is used directly in the UIASpy GUI, but not the UIA UDFs in this new thread.
  • Using UIA Code contains only example code, but neither UIA UDFs nor UIASpy.
  • UIA Events contains GUI code to detect events and it contains example code, but neither UIA UDFs nor UIASpy.

This means that every time the code in the UDF files in this new thread is updated (eg. because of Windows 10 feature updates twice a year), you must install the files in the Includes folders in the other threads yourself. The easiest way is simply to copy all UDF files to the Includes folders.

UDF Files

  • CUIAutomation2.au3        - UIA constants for Windows 7 used in the first examples
  • CUIAutomation2-a.au3    - The original UIA constants for Windows 7 from junkew's thread
  • UIA_AccVars.au3               - Used to calculate properties of type VT_UNKNOWN, copied and modified from this thread
  • UIA_Constants.au3           - UIA constants (copied from UIA header files) up to and including Windows 10 1809
  • UIA_ConstNames.au3      - Contains functions for converting UIA constants from values to names
  • UIA_Functions.au3           - A collection of small utility functions
  • UIA_Functions-a.au3        - First version of utility functions
  • UIA_ObjectFromTag.au3 - Creates callback objects used in event handlers, copied and modified from this post by trancexx
  • UIA_SafeArray.au3           - Constants and functions to handle safearrays, copied from this thread
  • UIA_Variant.au3               - Constants and functions to handle variants, copied from this thread
  • UIAEH_AutomationEventHandler.au3             - Implements the AutomationEventHandler
  • UIAEH_FocusChangedEventHandler.au3        - Implements the FocusChangedEventHandler
  • UIAEH_NotificationEventHandler.au3             - Implements the NotificationEventHandler, published in Windows 10 1709
  • UIAEH_PropertyChangedEventHandler.au3  - Implements the PropertyChangedEventHandler
  • UIAEH_StructureChangedEventHandler.au3 - Implements the StructureChangedEventHandler

The UI Automation projects can be stored in a folder structure this way:

  • UI Automation\
    • Code\       - Using UIA code
    • Events\    - UIA events
    • Spy tool\ - UIASpy.au3
    • UDFs\      - UDF files

The UDF files must be installed in Includes\ in the first three folders.


The zip contains source code for the UDF files.

You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10.

Comments are welcome. Let me know if there are any issues.


Edited by LarsJ

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...