Try this:
$MY_TITLE_REGEX = "(?:Title1|Title2)"
Opt("WinTitleMatchMode", 4)
$handle = WinGetHandle("[REGEXPTITLE:" & $MY_TITLE_REGEX & "]")
This way you are able to use regular expressions for window titles (as defined in $my_regex) in order to get a handle to the desired window.
The AutoIt Window Info Tool can be used as follows to determine the title of a open window:
- Open the target window you want to get the title for
- Open Autoit Window Info Tool
- Drag and drop the finder tool (the title cross hair on the right-hand-side) of the Window Info Tool on the target window
- As a result, various information about this window should now be displayed in the tool
- You can find the title of the window in the very first line (see below)
Source of original image
Hope this helps!