3.6.4.19 GetEnumWin (macro)

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

Definition:

Def GetEnumWin {
         doc -cp %1;win -T Plot %1 %1$(count+1)
};

Example:

Assuming that no graph windows exist which begin with the name MyGraph, the following script creates three graph windows named MyGraph1, MyGraph2, and MyGraph3 from the template ORIGIN.OTP, unless MYGRAPH.OTP exists, in which case it will be used.

GetEnumWin MyGraph;
GetEnumWin MyGraph;
GetEnumWin MyGraph;