This example is about using Microsoft UI Automation APIs in AutoIt. Ie. it's about using interfaces, objects, methods, properties and constants as they are defined directly by Microsoft.
In AutoIt, the definitions are contained in CUIAutomation2.au3 by junkew. The definitions are copied from corresponding C/C++ header files and customized the AutoIt language.
This example is not about the functions in UIAWrappers.au3 by junkew.
The purpose of the example is to show how to use Microsoft UI Automation APIs directly without any intermediate AutoIt functions.
A major advantage of this approach is that the Microsoft documentation directly can be used as AutoIt documentation.
Other major advantages are that there is no need for documenting and maintaining a set of intermediate AutoIt functions. Without intermediate AutoIt functions the code will be very fast. All Microsoft functions can be used this way eg. functions for event handling. New interfaces, objects, methods, properties and constants can easily be added simply by adding the definitions to CUIAutomation2.au3.
Is this approach difficult? Not at all as the examples will show.
The example is inspired by this comment of mLipok. Including documentation and pictures, even a simple Notepad automation can be somewhat comprehensive. Therefore a new example.
First post will be a list of examples. The examples themselves are reviewed in the following posts.
In all examples UIASpy is used to get element information.
Topics
Using UIASpy
UIASpy thread
Automating Notepad. Very detailed example.
Automating Notepad with Sample code - step by step
Automating Notepad with Sample code - all at once
Automating Notepad - Windows XP
Automating Notepad - Classic
Click Save As... issue
Automating Notepad context menu. Event handler example.
Chrome - Clicking an extension. Compact summary example.
Other spy tools
Using Microsoft Inspect.exe
simplespy.au3 by junkew
How to topics
If UI Automation or the UIASpy tool is new to you, then you should start reading the How to topics
Various topics
Console and terminal windows
Console application (3 posts)
Terminal program (several posts)
Examples
Patterns (actions)
Code snippets
Real examples
UIA updates
UIA events
Threads
UI Automation UDFs contains all include files.
UIASpy - UI Automation Spy Tool is a GUI tool that provides information about windows and controls and their interconnection and provides functionality to generate sample code. UIASpy is essential for creating UI Automation code.
UI Automation Events is about implementing event handlers and includes GUIs to detect events.
IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code.
Zip-file
The zip contains source files for all examples.
Note that UI Automation UDFs must be installed in the Includes folder.
You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10.
Comments and questions about using UIA code are welcome. Let me know if there are any issues.
Questions about the functions in UIAWrappers.au3 should be asked in junkew's thread.
UIAExamples.7z