}
if (rt!=null && rt.getCounter()!=0 && !summarized) {
if (path==null || path.equals("")) {
IJ.wait(10);
String name = isResults?"Results":title;
SaveDialog sd = new SaveDialog("Save Results", name, Prefs.get("options.ext", ".xls"));
String file = sd.getFileName();
if (file==null) return false;
path = sd.getDirectory() + file;
}
try {
rt.saveAs(path);
} catch (IOException e) {
IJ.error(""+e);
}
} else {
if (path.equals("")) {
IJ.wait(10);
boolean hasHeadings = !getColumnHeadings().equals("");
String ext = isResults||hasHeadings?Prefs.get("options.ext", ".xls"):".txt";
if (ext.equals(".csv")) ext = ".txt";
SaveDialog sd = new SaveDialog("Save as Text", title, ext);
String file = sd.getFileName();
if (file == null) return false;
path = sd.getDirectory() + file;
}
PrintWriter pw = null;
try {
FileOutputStream fos = new FileOutputStream(path);
BufferedOutputStream bos = new BufferedOutputStream(fos);