close all graphs without saving

I am constantly generating sets of graphs just to look at, and then I spend too long closing each graph individually without saving. Is there an easy way to close all open graphs at once (without saving)?

Thanks!
Use a user-define function.


Function KillAllGraphs()
	string fulllist = WinList("*", ";","WIN:1")
	string name, cmd
	variable i
	
	for(i=0; i<itemsinlist(fulllist); i +=1)
		name= stringfromlist(i, fulllist)
		sprintf  cmd, "Dowindow/K %s", name
		execute cmd		
	endfor
end



You can also make a macro so that you can call it from the menu.


macro  killGraphs()
KillAllGraphs()
end

Note that if you hold down the Alt key when you click the close button on a graph, Igor won't ask you whether or not you want to save the recreation macro--it will just kill the graph. This also works for other window types such as tables, panels, and layouts.
You can write the KillAllGraphs function without using Execute.

Rather than this:

name= stringfromlist(i, fulllist)
sprintf  cmd, "Dowindow/K %s", name
execute cmd	


you can do this:


name= stringfromlist(i, fulllist)
Dowindow/K $name


This illustrates the general principle that $ converts a string expression to an object name.

For details:

DisplayHelpTopic "String Substitution Using $"