One of the best features with AutoIt v3 is the ability to work directly with certain types of Window Controls. Almost everything you see on a window is a control of some kind. Buttons, listboxes, edit fields and static text are all examples of controls. In fact, Notepad is just one big "Edit" control! Because AutoIt works directly with a control, they provide a more reliable way to automate than just sending keystrokes.
Note: AutoIt only works with standard Microsoft controls. Some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!
Using the AutoIt Window Info Tool you can move your mouse around the window you are interested in and you will be given information of the control that is currently under your mouse.
A special description can be used as the controlID parameter used in most of the Control...() functions. This description can be used to identify a control by the following properties:
One or more properties are used in the controlID parameter of a control command in the format:
[PROPERTY1 : Value1; PROPERTY2:Value2]
Note: If this special format is not used then the parameter is taken to be a control ID (if numeric) or the ClassnameNN/text of the control (if a string). Although the special format is more long-winded than these methods it is much less ambiguous.
If a Value must contain a ";" it must be doubled.
e.g. Send text to the 1st Edit control in the Notepad window
ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "This is some text")
or
ControlSend("Untitled - Notepad", "", "[CLASSNN:Edit1]", "This is some text")
or
ControlSend("Untitled - Notepad", "", "Edit1", "This is some text")
e.g. Click on control ID 254 in "My Window"
ControlClick("My Window", "", "[ID:254]")
or
ControlClick("My Window", "", 254)
e.g. Set the text of the .NET Winforms "textBoxFolder" control to "C:\Some\Folder"
ControlSetText("My Window", "", "[NAME:textBoxFolder]", "C:\Some\Folder")
e.g. Click the 2nd instance of a "Button" control containing the text "Finish"
ControlClick("My Window", "", "[CLASS:Button; TEXT:Finish; INSTANCE:2]")
Using the ControlGetHandle function you can determine the Handle or HWND of a control. A handle is the unique identifier that Windows gives controls. The handle changes each time the control is created. This method of accessing controls is generally only designed for users who are familiar with working with handles.
Look under the contents for Function Reference \ Window Management \ Controls for a list of the functions that work with controls.