GetNamedPlot (macro)

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


Def GetNamedPlot {
       if (exist(%1)==3) win -active %1; else win -T Plot %2 %1;


Assuming that no graph window with the name MyGraph1 exists, the following script creates the graph window MyGraph1 from the template MYTEMPLATE.OTP. After making the graph window SomeOtherGraph the active window, the script re-activates the graph window MyGraph1.

GetNamedPlot MyGraph1 MyTemplate;
Win -a SomeOtherGraph;
GetNamedPlot MyGraph1 MyTemplate;