Posted by Catur Nugroho | File under :
Autoit Control Enable / Disable Using C#

Disables or "grays-out" a control.
ControlDisable ( "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 controlDisableButton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

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

            //Disable Text Area
            autoit.ControlDisable("[CLASS:Notepad]", "", "Edit1");
            Thread.Sleep(1000);

            //Enable Text Area
            autoit.ControlEnable("[CLASS:Notepad]", "", "Edit1");
            Thread.Sleep(1000);
        }


Download Full Source Code

0 comments:

Post a Comment