# Controls

Eines der besten Features von AutoIt v3 ist die Möglichkeit, direkt mit verschiedenen Arten von Window Controls zu arbeiten. Almost everything you see on a window is a control of some kind: buttons, listboxes, edit fields, static text are all 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. Information on controls is given in a number of ways, these are:

- Control ID
- ClassNameNN
- Text
- Control Handle (HWND) (Not available in AutoIt Window Info Tool - see below)

Whenever you see a Control...() command expecting a ControlID parameter (most of them) you can use any one of these methods. The method you choose will vary by personal preference and the information you are able to retrieve from the AutoIt Window Info Tool. In general, the best method to use is the Control ID, with the other methods being used when a Control ID is not available or is not unique (usually with static text each piece of text actually has the same Control ID so you will need to use one of the other methods to work with those controls).

## Control ID

The Control ID is the internal numeric identifier that windows gives to each control. It is generally the best method of indentifying controls. In addition to the AutoIt Window Info Tool, other applications such as screenreaders for the blind and Microsoft tools/APIs may allow you to get this Control ID.

## ClassNameNN

Each Microsoft standard control has a "classname" such as "button" or "edit". In AutoIt this is combined with the "instance" of that control to give the "ClassNameNN" method. If you have a simple dialog with a few buttons on it they will generally be referred to as "Button1", "Button2", "Button3", etc.

This method is useful when the Control ID is not applicable (for static text or custom controls).

## Text

You will notice that AU3Info gives you the text it can see on a control, for example on a Next button you might see the text &Next - the & indicates that the next letter is underlined and is common when working with menus and controls. You can use this text to identify a control in place of the "ClassNameNN" if you like - however if many controls have the same text you will run into problems.

## Control Handle (HWND)

Using the ControlGetHandle function you can determine the Handle or HWND of a control. A handle is the unique indentifier 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 familar with working with handles.

Look under the contents for Function Reference \ Window Management \ Controls for a list of the functions that work with controls.