Posted by Catur Nugroho | File under :

Autoit Control Get Text Using C#

Retrieves text from a control.
ControlGetText ( "title", "text", controlID )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.

Return Value

Success: Returns text from a control.
Failure: Sets @error to 1 and returns a blank string of "".

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Control Get Text In C#


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

 private void controlGetTextbutton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            //send text example
            autoit.ControlSend("[CLASS:Notepad]", "", "Edit1", "autoitsourcode.blogspot.com", 0);

            //get the texts
            string strReturnText = autoit.ControlGetText("[CLASS:Notepad]", "", "Edit1");

            returnGetTextLabel.Text = "Return text from text area notepad : \n" + strReturnText;
        }


 Download Full Source Code


0 comments:

Post a Comment