Forum Discussion

ext-kadams's avatar
ext-kadams
New Contributor
2 years ago

How to wait on Command prompt till specific wText appeared

Is there any way to wait on command line window till the specific text is appeared in wText of Command prompt.

I have used below mentioned code, but it is not working:

var timeoutMinutes = 5
var loopDelay = 5000
var loopCount = 0
var loopCountMax = timeoutMinutes * 60 * 1000 / loopDelay // Timeout 5 Minutes
while(name == "Closing Projects..." )
{
var window = Aliases.cmd.wndConsoleWindowClass2;
var txt = window.wText;
aqString.ListSeparator = "\r\n";
s = aqString.GetListItem(txt, loopCount)
Log.Message(s);
if(s == "Closing Projects...")
break
loopCount++
rowcount = aqString.GetListLength(txt);
Log.Message(rowcount)
Log.Message(loopCount)
}

 

2 Replies

    • ext-kadams's avatar
      ext-kadams
      New Contributor

      The loop is not waiting till the text "Closing Projects" is appearing on Command prompt.

      I have also checked it on Smartbear [reference] but not found any solution.