Posted by Catur Nugroho | File under :

Autoit Control Focus Using C#

Sets input focus to a given control on a window.
ControlFocus ( "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 1.
Failure: Returns 0.

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Control Enable / Disable in C#



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

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

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

            //set the focus
            //in C# code similar with this.focus()           
            autoit.ControlFocus("[CLASS:Notepad]", "", "Edit1");
        }


Download Full Source Code

0 comments:

Post a Comment