GetNamedWin (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 default template ORIGIN.OTP.


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


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

GetNamedWin MyGraph1;
Win -a SomeOtherGraph;
GetNamedWin MyGraph1;