Hi Richard,
On Tue, 17 Apr 2012, Richard Mort wrote:
> I have a whole bunch of windows open and I'd like to just save the ones with
> "Raw" in the title and append the names to 1_Raw.xls, 2_Raw.xls etc etc. I
> think the following macro code should work:
>
> window = 0;
> window_ID = 0;
> list = getList("window.titles");
> for (b=1; b<(list.length); b++) {
> window = substring(list [b], 0, 3);
> if (window=="Raw") {
> window_ID++;
> selectWindow(list [b]);
> saveAs("Measurements", window_ID+"_Raw.xls");}
As far as I can tell, IJ1 can track only one instance of a Results window.
> else {}
>
> It finds the windows and saves the correct number of files but when I open
> them they are all the same. On further investigation when I try and manually
> save each window and then I go to open them they are all the same too! So I
> don't think the problem is my code as in-elegant as it may be. I am trying to
> save the output from the WrMTrck plugin
> (
http://www.phage.dk/plugins/wrmtrck.html).
>
> Using Fiji with ImageJ version 1.46k
Since you are using Fiji, Beanshell scripting is available. So something
like this might work (File>New>Script, then Language>Beanshell, paste and
Run>Run):
-- snipsnap --
counter = 1;
for (java.awt.Frame frame : WindowManager.getNonImageWindows()) {
if (!(frame instanceof TextWindow))
continue;
textPanel = frame.getTextPanel();
if (textPanel == null)
continue;
resultsTable = textPanel.getResultsTable();
if (resultsTable == null)
continue;
resultsTable.saveAs(counter + "_Raw.xls");
counter++;
}