SetTitleMatchMode

Sets the matching behavior of the WinTitle parameter in commands such as WinWait.

SetTitleMatchMode, MatchMode
SetTitleMatchMode, Speed

Parameters

MatchMode

Specify one of the following digits or the word RegEx:

The modes above also affect ExcludeTitle in the same way as WinTitle. For example, mode 3 requires that a window's title exactly match ExcludeTitle for that window to be excluded.

Speed

One of the following words to specify how the WinText and ExcludeText parameters should be matched:

Fast: This is the default behavior. Performance may be substantially better than Slow, but certain types of controls are not detected. For instance, text is typically detected within Static and Button controls, but not Edit controls, unless they are owned by the script.

Slow: Can be much slower, but works with all controls which respond to the WM_GETTEXT message.

Remarks

This command affects the behavior of all windowing functions and commands, e.g. WinExist() and WinActivate. WinGetText is affected in the same way as other commands, but it always uses the Slow method to retrieve text.

If unspecified, TitleMatchMode defaults to 1 and fast.

If a window group is used, the current title match mode applies to each individual rule in the group.

Generally, the slow mode should be used only if the target window cannot be uniquely identified by its title and fast-mode text. This is because the slow mode can be extremely slow if there are any application windows that are busy or "not responding".

Window Spy has an option for Slow TitleMatchMode so that its easy to determine whether the Slow mode is needed.

If you wish to change both attributes, run the command twice as in this example:

SetTitleMatchMode, 2
SetTitleMatchMode, slow

The built-in variables A_TitleMatchMode and A_TitleMatchModeSpeed contain the current settings.

Regardless of the current TitleMatchMode, WinTitle, WinText, ExcludeTitle and ExcludeText are case sensitive. The only exception is the case-insensitive option of the RegEx mode; for example: i)untitled - notepad.

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).

SetWinDelay, WinExist(), WinActivate, RegExMatch()

Examples

Allows windowing functions and commands to operate upon windows whose titles contain WinTitle anywhere instead of at the beginning.

SetTitleMatchMode 2

Allows windowing functions and commands to detect more control types, but with lower performance. Note that Slow/Fast can be set independently of all the other modes.

SetTitleMatchMode Slow