Save All Graphs As Graphics Files

Average rating
(1 vote)

//	SaveAllGraphsAsGraphicsFiles(pathName, extension, visibleOnly, format, bitmapRes)
//	NOTE: This overwrites existing files with the same name.
//	Example:
//		SaveAllGraphsAsGraphicsFiles("home", ".png", 1, -5, 288)
Function SaveAllGraphsAsGraphicsFiles(pathName, extension, visibleOnly, format, bitmapRes)
	String pathName			// Name of Igor symbolic path pointing to folder where graphics should be saved.
	String extension				// Extension for file name, e.g., ".tif", ".pdf", ".png" . . .
	Variable visibleOnly			// 1 to save only visible graphs, 0 to save visible and hidden graphs.
	Variable format				// For SavePICT /E flag. See SavePICT documentation.
	Variable bitmapRes			// For SavePICT /RES flag (e.g., 288 for 288 dpi).
 
	Variable index = 0
	do
		String graphName = WinName(index, 1, visibleOnly)
		if (strlen(graphName) == 0)
			break					// All done
		endif
 
		String fileName = graphName + extension
		SavePICT /N=$graphName /O /P=$pathName /E=(format) /RES=(bitmapRes) as fileName
 
		index += 1
	while(1)
End

Back to top