Debugging windows opened as local variables

One way to open a window is by declaring a local variable of type window and opening it through a string. For example:

window mywin
string named_window
named_window = sle_1.Text
Open(mywin, named_window)

The problem

Normally, you cannot debug windows opened this way after the script ends because the local variable (mywin in the preceding script) goes out of scope when the script ends.

The solution

If you want to debug windows opened this way, you can declare a global variable of type window and assign it the local variable. If, for example, GlobalWindow is a global window of type window, you could add the following line to the end of the preceding script:

GlobalWindow = mywin

You can look at and modify the opened window through the global variable. When you have finished debugging the window, you can remove the global variable and the statement assigning the local to the global.