3.6.4.20 GetEnumWks (macro)

Counts the number of worksheet windows that exist and match exactly or begin with the name winName. If no worksheet window exists, it creates one with the name winName1. If n worksheet windows exist, it creates one with the name winName$(n+1). If winName also happens to be the name of a worksheet template, it will create the worksheet window from the template WINNAME.OTW. Otherwise, it will use the default template ORIGIN.OTW.

Definition:

Def GetEnumWks 
{
      stat.name(1,%1);
      %A = stat.name.worksheet$;
      win -T Wks %1 %A;
}

Example:

Assuming that no worksheet windows exist which begin with the name MyData, the following script creates three worksheet windows named MyData1, MyData2, and MyData3 from the template ORIGIN.OTW, unless MYDATA.OTW exists, in which case it will be used.

GetEnumWks MyData;
GetEnumWks MyData;
GetEnumWks MyData;