Function Reference


WinSetTitle

Changes the title of a window.

WinSetTitle ( "title", "text", "newtitle" )

Parameters

title The title/hWnd/class of the window to change. See Title special definition.
text The text of the window to change. See Text special definition.
newtitle The new title to give to the window.

Return Value

Success: 1.
Failure: 0 if the window is not found.

Remarks

If multiple windows match the criteria the title of most recently active window is changed.

CAUTION: From Windows release 19H1 the title of "notepad.exe" reverts to the original when the window gets focus !!!

Related

AutoItWinSetTitle, WinGetHandle, WinGetTitle, WinTitleMatchMode (Option)

Example

Example()

Func Example()
        ; Run Write
        Run("Write.exe")

        ; Wait 10 seconds for the Write window to appear.
        Local $hWnd = WinWait("[CLASS:WordPadClass]", "", 10)

        ; Set the title of the Write window using the handle returned by WinWait.
        WinSetTitle($hWnd, "", "New WordPad Title - AutoIt")

        ; Wait for 2 seconds to display the Write window and the new title.
        Sleep(2000)

        ; Close the Write window using the handle returned by WinWait.
        WinClose($hWnd)
EndFunc   ;==>Example