GetEnumTempWks (macro)

Counts the number of worksheet windows that exist and match exactly or begin with the name winName. If no worksheet exists, it creates a worksheet with the name winName1 from the worksheet template template. If n worksheets exist, it creates a worksheet with the name winName$(n+1) from the template template.


Definition:

Def GetEnumTempWks {
      doc -cw %2;
      %A=%2$(count+1);  //Set %A to be the name of the new window
      win -th Wks %1 %A;
};

Example:

Assuming that no worksheet windows exist which begin with the name MyData, the following script creates three worksheets named MyData1, MyData2, and MyData3 from the template ORIGIN.OTW.

GetEnumTempWks Origin MyData;
GetEnumTempWks Origin MyData;
GetEnumTempWks Origin MyData;