Search code examples
autoit

How to capture Window title by using Window info tool in Autoit


Please tell me that how to capture the window title using “Window Info tool” and how can i use regular expression for window title part of Auto IT script to identify the window at run time.

My code is working Fine for IE but i want it to work for chrome too . is there any way to handle the window at run time using AutoIT


Solution

  • 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:

    1. Open the target window you want to get the title for
    2. Open Autoit Window Info Tool
    3. Drag and drop the finder tool (the title cross hair on the right-hand-side) of the Window Info Tool on the target window
    4. As a result, various information about this window should now be displayed in the tool
    5. You can find the title of the window in the very first line (see below)

    See finder tool and the window title are marked Source of original image

    Hope this helps!