Log window partial selection

Hi all,

I would like to ask my macro to copy&save from a Log window containing many lines of info/results generated by a plugin used by my macro, only few lines of that info/results (in my case just the 4 final lines).
Which is the best approach to do that?

Thanks a lot in advance for your help!
Michela

Hey,

there might be a more elegant solution to this, but you might try to save the log window as a csv table and open it as a results table.

I tried the following:

output = "C:/Users/User/Desktop/"
print("Line\tValue");
print("First line:\t5");
print("Second line:\t10");
print("Third line:\t15");
print("Forth line:\t20");
selectWindow("Log");
saveAs("Text", output + "LogResults.csv");

Table.open(output + "LogResults.csv");
IJ.renameResults("Results");
for(i=nResults-2;i<nResults;i++){
	print("");
	a = getResultString("Line", i);
	b = getResult("Value", i);
	print(a + "\t" + b);
}

This depends a lot on how the Log-Infos are organized. Do you mind sharing an example of the log window?