Posted by Catur Nugroho | File under :

Autoit Control Move Using C#

Moves a control within a window.
ControlMove ( "title", "text", controlID, x, y [, width [, height]] )

Parameters

title The title of the window to move.
text The text of the window to move.
controlID The control to interact with. See Controls.
x X coordinate to move to relative to the window client area.
y Y coordinate to move to relative to the window client area.
width [optional] New width of the window.
height [optional] New height of the window.

Return Value

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

Remarks

If x and y equal to the Default keyword no move occurs, just resizing.

Source : Autoit Help Document

Source Code Autoit Control Move In C#

 


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

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

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

            if (MessageBox.Show("Are you sure want to move it?", "confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
            {
                autoit.ControlMove("[CLASS:Notepad]", "", "Edit1", 200, 200, 200, 200);
            }
        }


Download Full Source Code

0 comments:

Post a Comment