I've posted (http://www.igorexchange.com/node/8213) some code that I use fairly often for this. It may need some modification for your purpose, depending on your requirements for file naming.
I wrote a pair of functions just recently, intended to save all graphs in an experiment. It tries to save to a folder called "graphs" that you can create by hand in advance or after the routine starts. To run it, execute SaveAllGraphs().
//Saves all graphs in experiment as PDF files in the //same folder as the experiment or in subfolder called "graphs" Function SaveAllGraphs()
variable NGraphs, i string graphList, alertStr, currWindow
//Save top window graph using its window's name //Top window must be a graph. Graph you want to save must be top window //Graph is saved as pdf file in folder called "graphs" in the home path (folder //of the current igor experiment), which you can create in advance or in response to the dialog //box that appears if "graphs" does not exist. //Filename is created from igor experiment name and graph window's title Function saveGraph()
string windowTitleStr, titleFirstWord
//Obtain window's title's first word, to be used as part of the filename //e.g., if autonamed graph1:y vs x, then extract "graph1" getWindow kwTopWin, wtitle //(I am getting title because I don't know how to get the window's name)
windowTitleStr = S_Value
titleFirstWord = stringFromList(0, windowTitleStr, ":")
string alertStr
alertStr = "Will try to save graph with title " + windowTitleStr
alertStr += " as a pdf file in same folder as present Igor"
alertStr += " experiment, \nusing name " + fName doWindow/H /F print alertStr
SavePICT
in a loop should do the job. For details, please consult the manual.HJ
March 1, 2018 at 02:33 am - Permalink
graph0, graph1, graph0
:•print s_value
Printer XPS;Printer PDF;Printer PCL;Printer OneNote;Printer 666;
•PrintSettings/W=graph0 setPrinter="Printer PDF"
•PrintSettings/W=graph1 setPrinter="Printer PDF"
•PrintGraphs/t Graph0, Graph1, graph0
best,
_sk
March 1, 2018 at 06:24 am - Permalink
March 1, 2018 at 07:01 am - Permalink
//same folder as the experiment or in subfolder called "graphs"
Function SaveAllGraphs()
variable NGraphs, i
string graphList, alertStr, currWindow
GraphList = WinList("*", ";", "WIN:1")
graphList = RemoveFromList("SnglMove", graphList)
NGraphs = itemsInList(GraphList)
string homePathStr, graphPathStr
pathInfo home
homePathStr = S_path
graphPathStr = homePathStr + "graphs"
newPath /O graphs, graphPathStr
print "will save graphs for all runs in " + graphPathStr
for (i = 0; i < NGraphs; i += 1)
currWindow = stringFromList(i, graphList)
doWindow /F $currWindow
saveGraph()
endFor
End //SaveAllGraphs
//Save top window graph using its window's name
//Top window must be a graph. Graph you want to save must be top window
//Graph is saved as pdf file in folder called "graphs" in the home path (folder
//of the current igor experiment), which you can create in advance or in response to the dialog
//box that appears if "graphs" does not exist.
//Filename is created from igor experiment name and graph window's title
Function saveGraph()
string windowTitleStr, titleFirstWord
//Obtain window's title's first word, to be used as part of the filename
//e.g., if autonamed graph1:y vs x, then extract "graph1"
getWindow kwTopWin, wtitle
//(I am getting title because I don't know how to get the window's name)
windowTitleStr = S_Value
titleFirstWord = stringFromList(0, windowTitleStr, ":")
string exptName, fName
exptName = igorInfo(1)
fName = titleFirstWord + "_" + exptName
print "windowTitleStr", windowTitleStr
print "titleFirstWord", titleFirstWord
print "fName", fName
string alertStr
alertStr = "Will try to save graph with title " + windowTitleStr
alertStr += " as a pdf file in same folder as present Igor"
alertStr += " experiment, \nusing name " + fName
doWindow /H /F
print alertStr
SavePICT /Z/O/P=graphs/E=-2/W=(0,0,0,0) as fName
if (V_flag == 0)
alertStr = "Graph saved successfully."
else
alertStr = "***An error occurred. Graph not saved"
endIf
print alertStr
End //saveGraph()
March 7, 2018 at 09:56 am - Permalink
Late question, but how do you want to export them... to an image file, printed, to the clipboard for pasting into document?
March 7, 2018 at 05:10 am - Permalink