DevaV
14 years agoContributor
The window was destroyed during method execution.
Hi,
We get the error message 'Window is destroyed during method execution' while executing the scripts. Please find the code below.
This error is usually logged while trying to close the window (if it exists) in the finally block.
Please let us know to resolve this scenario
We get the error message 'Window is destroyed during method execution' while executing the scripts. Please find the code below.
This error is usually logged while trying to close the window (if it exists) in the finally block.
function test(){
var dlgSchedule;
try {
dlgSchedule = Sys.Process("mmc").WaitWindow("MMCMainFrame", "Task Scheduler", -1,1000); //Opens the task scheduler window
dlgSchedule.Close(); //Close the task scheduler window
Delay(500);
dlgSchedule.Refresh();
Delay(500);
}
catch(exception){
Log.Error(exception.message, exception.description);
}
finally{
if(dlgSchedule !== undefined && dlgSchedule.Exists) //Close the task scheduler window if it exists
dlgSchedule.Close()
/* Also tried to close the dialog as below
if(Sys.Process("mmc").WaitWindow("MMCMainFrame", "Task Scheduler", -1,1000).Exists)
Sys.Process("mmc").WaitWindow("MMCMainFrame", "Task Scheduler", -1,1000).Close();
*/
}
}
Please let us know to resolve this scenario