#pragma rtGlobals=3 // Use modern global access method and strict wave access. Function /S returnWindowStr(win,n) String win // Name of the window to recreate Variable n // n'th window being merged String line, win_cmd = "", win_rec=WinRecreation(win,0) Variable i, a, b, c, d, e, f for(i=0;i=1 && strsearch(line, "Display",0) != -1 ) line = RemoveByKey("/W",ReplaceString("Display", line , "AppendToGraph"),"=", " ") endif //Boolean variables that track whether line contains certain strings a=strsearch(line, "Window",0) == -1 b=strsearch(line, "ModifyGraph",0) == -1 c=strsearch(line, "ShowInfo",0) == -1 d=strsearch(line, "PauseUpdate",0) == -1 e=strsearch(line, "EndMacro",0) == -1 f=strsearch(line, "fldrSav0",0) != -1 //Change fldrSav0 string created by WinRecreation if(f) line = ReplaceString("fldrSav0", line, "fldrSav" + num2str(n)) endif //Only take commands that involve generating plots If(a && b && c && d && e) win_cmd += line + "\r" endif endfor return win_cmd End Function mergeWindows(winL) String winL Variable i, d=0, numWins = ItemsInList(winL) String command = "Window " + UniqueName("Graph",6,0) + "() : Graph \r \tPauseUpdate; Silent 1\t\t// building window...\r" For(i=0;i