GetNamedWks (macro)

Checks to see if the worksheet window winName exists. If so, it makes the worksheet window winName the active window. If not, it creates a worksheet window named winName from the template template.



Def GetNamedWks {
      if (exist(%1)==2) win -active %1; else win -T WKS %2 %1;


Assuming that no worksheet window with the name MyData1 exists, the following script creates the worksheet window MyData1 from the template MYTEMPLATE.OTW. After making the worksheet window SomeOtherWks the active window, the script re-activates the worksheet window MyData1.

GetNamedWks MyData1 MyTemplate;
Win -a SomeOtherWks;
GetNamedWks MyData1 MyTemplate;