Autoit Win Wait Using C#
WinWaitPauses execution of the script until the requested window exists.
WinWait ( "title" [, "text" [, timeout]] )
Parameters
title | The title of the window to check. See Title special definition. |
text | [optional] The text of the window to check. |
timeout | [optional] Timeout in seconds |
Return Value
Success: | Returns handle to the requested window. |
Failure: | Returns 0 if timeout occurred. |
Remarks
None.
Source : Autoit Help Document
Source Code Autoit Win Wait In C#
Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Time out :
private void winWaitButton_Click(object sender, EventArgs e)
{
DateTime dtStart = DateTime.Now;
//open notepad
autoit.Run("Notepad.exe", "", 1);
//Wait a maximum of 20 seconds for "[CLASS:Notepad]" to exist
autoit.WinWait("[CLASS:Notepad]", "", 20);
label1.Text = "waiting for " + (DateTime.Now - dtStart).Seconds.ToString() + " seconds";
}
Download Full Source Code (look into source code if the notepad doesn't exist)
0 comments:
Post a Comment