One strategy:
Use Winlist to get a master list off all open windows.
Use Winlist to get a list of all Layouts and remove those window names from the master list.
Use Layoutinfo for each layout to get a list of objects used in each layout and remove those windows from the master list.
What is left is a list of windows not included in any open layout which can be killed/closed.
One strategy:
Use Winlist to get a master list off all open windows.
Use Winlist to get a list of all Layouts and remove those window names from the master list.
Use Layoutinfo for each layout to get a list of objects used in each layout and remove those windows from the master list.
What is left is a list of windows not included in any open layout which can be killed/closed.
Andy
February 11, 2018 at 07:24 am - Permalink
String graphName
String layoutList = WinList("*", ";", "WIN:4")
Variable numLayouts = ItemsInList(layoutList)
Variable layoutIndex
for(layoutIndex=0; layoutIndex<numLayouts; layoutIndex+=1)
String layoutName = StringFromList(layoutIndex, layoutList)
Variable objectIndex = 0
do
String objectIndexStr
sprintf objectIndexStr, "%d", objectIndex
String info = LayoutInfo(layoutName, objectIndexStr)
if (strlen(info) == 0)
break // No more objects in this layout
endif
String typeStr = StringByKey("TYPE", info)
if (CmpStr(typeStr,"Graph") == 0)
String nameStr = StringByKey("NAME", info)
if (CmpStr(nameStr, graphName) == 0)
return 1 // The graph is in this layout
endif
endif
objectIndex += 1
while(1)
endfor
return 0 // The graph is not in this layout
End
Function KillGraphsNotInLayout()
String graphList = WinList("*", ";", "WIN:1")
Variable numGraphs = ItemsInList(graphList)
Variable graphIndex
for(graphIndex=0; graphIndex<numGraphs; graphIndex+=1)
String graphName = StringFromList(graphIndex, graphList)
if (IsGraphInLayout(graphName) == 0)
KillWindow $graphName
Printf "Killed %s\r", graphName
endif
endfor
End
February 11, 2018 at 07:55 am - Permalink