iamraj09
11 years agoContributor
Unable to make the process wait till Window is closed
Hi,
My name is Guru. I have recently started to work on Test Complete. I am trying to make the instructions to wait till a specific window is closed.
The following is the part of the code where I got stuck. Please guide me through.Thanks in advance.
StopWatch = HISUtils["StopWatch"];
Central = Sys.Process("Central");
// ref for the device list ....
Status_Bar=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("_statusBar");
Delay(1000);
DeviceSpace=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "", 2).WinFormsObject("Devices").WinFormsObject("Devices").WinFormsObject("_treeTableView").WinFormsObject("InternalListView", "");
DeviceSpace.ClickItem("MyController (TM241CEC24T/U) ", 0);
DeviceSpace.Keys("[Down][Down]");
DeviceSpace.ClickItemR("Application ", 0);
//DeviceSpace.ClickItemR("Application ", 0);
Delay(800);
DeviceSpace.Keys("[Down][Down][Down][Down][Down][Down]");
DeviceSpace.Keys("[Enter]");
StopWatch["Start"]();
Sys.Process("Central").WaitWindow("*","Add Function From Template",-1,1000000);
Add_Template_Window=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog"); // this is the window for which I have to wait to close
StopWatch.Stop();
Time=StopWatch.ToString();
Excel_Launch = Sys["OleObject"]("Excel.Application");
Excel_Launch["Visible"]=true;
Book=Excel_Launch.Sheets("Tabelle1");
Excel_Launch.DisplayAlerts=false;
Book.Cells(10,1)="Time taken for ADD_Template_Window to PopUP is ";
Book.Cells(10,2)= Time;
Book["SaveAs"]("Worksheet");
Time="";
Delay(1000);
Enter_Template_Name=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("textBoxFunctionName");
Enter_Template_Name.SetText("ATV32_Node01"); // Entering the Template name ...
Browse_Template=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("buttonSelectTemplate");
Browse_Template["Click"]();
Select_Template=Sys.Process("Central").WinFormsObject("SelectionDialog").WinFormsObject("SelectionControl", "").WinFormsObject("TreeTableView").WinFormsObject("InternalListView", "");
Select_Template.ClickItem("ATV32_CANopen ", 0);
Add_Template_Button=Sys.Process("Central").WinFormsObject("SelectionDialog").WinFormsObject("buttonOK");
Add_Template_Button.ClickButton();
Enter_Template_Name.Click();
//var Template_address_area=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("gridViewDevices");
var Template_OK=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("buttonOK");
Template_OK.ClickButton();
StopWatch["Start"]();
while(Add_Template_Window.Exists==true){ // this is the loop that I have tried ..
while(!Template_OK.Enabled)
{
Delay(800);
break;
}
}
StopWatch["Stop"]();
Time=StopWatch["ToString"]();
StopWatch["Reset"]();
Book.Cells(11,1)="Time taken for adding ATV32_Node01 is ";
Book.Cells(11,2)= Time;
Book["SaveAs"]("Worksheet");
Best Regard
Guru
My name is Guru. I have recently started to work on Test Complete. I am trying to make the instructions to wait till a specific window is closed.
The following is the part of the code where I got stuck. Please guide me through.Thanks in advance.
StopWatch = HISUtils["StopWatch"];
Central = Sys.Process("Central");
// ref for the device list ....
Status_Bar=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("_statusBar");
Delay(1000);
DeviceSpace=Sys.Process("Central").WinFormsObject("MainForm").WinFormsObject("DockContainer", "", 2).WinFormsObject("Devices").WinFormsObject("Devices").WinFormsObject("_treeTableView").WinFormsObject("InternalListView", "");
DeviceSpace.ClickItem("MyController (TM241CEC24T/U) ", 0);
DeviceSpace.Keys("[Down][Down]");
DeviceSpace.ClickItemR("Application ", 0);
//DeviceSpace.ClickItemR("Application ", 0);
Delay(800);
DeviceSpace.Keys("[Down][Down][Down][Down][Down][Down]");
DeviceSpace.Keys("[Enter]");
StopWatch["Start"]();
Sys.Process("Central").WaitWindow("*","Add Function From Template",-1,1000000);
Add_Template_Window=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog"); // this is the window for which I have to wait to close
StopWatch.Stop();
Time=StopWatch.ToString();
Excel_Launch = Sys["OleObject"]("Excel.Application");
Excel_Launch["Visible"]=true;
Book=Excel_Launch.Sheets("Tabelle1");
Excel_Launch.DisplayAlerts=false;
Book.Cells(10,1)="Time taken for ADD_Template_Window to PopUP is ";
Book.Cells(10,2)= Time;
Book["SaveAs"]("Worksheet");
Time="";
Delay(1000);
Enter_Template_Name=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("textBoxFunctionName");
Enter_Template_Name.SetText("ATV32_Node01"); // Entering the Template name ...
Browse_Template=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("buttonSelectTemplate");
Browse_Template["Click"]();
Select_Template=Sys.Process("Central").WinFormsObject("SelectionDialog").WinFormsObject("SelectionControl", "").WinFormsObject("TreeTableView").WinFormsObject("InternalListView", "");
Select_Template.ClickItem("ATV32_CANopen ", 0);
Add_Template_Button=Sys.Process("Central").WinFormsObject("SelectionDialog").WinFormsObject("buttonOK");
Add_Template_Button.ClickButton();
Enter_Template_Name.Click();
//var Template_address_area=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("gridViewDevices");
var Template_OK=Sys.Process("Central").WinFormsObject("FunctionTemplateInstantiationDialog").WinFormsObject("buttonOK");
Template_OK.ClickButton();
StopWatch["Start"]();
while(Add_Template_Window.Exists==true){ // this is the loop that I have tried ..
while(!Template_OK.Enabled)
{
Delay(800);
break;
}
}
StopWatch["Stop"]();
Time=StopWatch["ToString"]();
StopWatch["Reset"]();
Book.Cells(11,1)="Time taken for adding ATV32_Node01 is ";
Book.Cells(11,2)= Time;
Book["SaveAs"]("Worksheet");
Best Regard
Guru