# Function Reference

# ControlSetText

Sets text of a control.

ControlSetText ( "title", "text", controlID, "new text" [, flag = 0] )

## Parameters

title | The title/hWnd/class of the window to access. See Title special definition.
text | The text of the window to access. See Text special definition.
controlID | The control to interact with. See Controls.
new text | The new text to be set into the control.
flag | [optional] when different from 0 (default) will force the target window to be redrawn.

## Return Value

Success: | 1.
Failure: | 0 if window/control is not found.

## Related

ControlCommand, ControlGetText, ControlSend, SplashTextOn

## Example

    #include "Extras\HelpFileInternals.au3"

    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        ; Run Notepad
        Run("notepad.exe")

        Local $hWnd = WinWaitActive("[CLASS:Notepad]", "")

        ; Set the edit control in Notepad with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText.
        ControlSetText($hWnd, "", ControlGetFocus($hWnd), "This is some text")

        ; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText.
        Local $sText = ControlGetText($hWnd, "", ControlGetFocus($hWnd))

        ; Display the text of the edit control.
        MsgBox($MB_SYSTEMMODAL, "", "The text in " & ControlGetFocus($hWnd) & " is: " & $sText)

        _NotepadForceClose($hWnd)
    EndFunc   ;==>Example