Autoit Win Wait Active Using C#
Pauses execution of the script until the requested window is active.
WinWaitActive ( "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 and be active
autoit.WinWaitActive("[CLASS:Notepad]", "", 20);
label1.Text = "waiting for " + (DateTime.Now - dtStart).Seconds.ToString() + " seconds from 10 seconds";
}
Download Full Source Code (look into source code if the notepad doesn't exist)
0 comments:
Post a Comment