<html>
    <head>
      <base href="http://fiji.sc/bugzilla/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - saveAs("Results", "...") does not work"
   href="http://fiji.sc/bugzilla/show_bug.cgi?id=987#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - saveAs("Results", "...") does not work"
   href="http://fiji.sc/bugzilla/show_bug.cgi?id=987">bug 987</a>
              from <span class="vcard"><a class="email" href="mailto:tokamoto@biosearchtech.com" title="tokamoto@biosearchtech.com">tokamoto@biosearchtech.com</a>
</span></b>
        <pre>I've re-created the issue in a macro that emulates my macro, and the steps that
it takes through functions and saving to the tables.  

In my macro, I'm running the Measure tool on three separate selections on an
image (emulated here by creating some random data) and then doing some
calculations based on the results (emulated here by calculating the ratio and
half ratio).  The results are saved on the first row in their own column, and
then all three rows are printed to the Points table, replacing the space
between data with commas.  Since I still have the ratios stored in variables, I
print just the results to another table that excludes the raw measure data from
earlier.  After it runs on all images in a directory(emulated here by just
running it ten times) it selects the tables, saves them, and then closes them.

The macro below works on 1.49m, but not 1.49n.  If you comment out the close
commands after the saveAs commands, you can see the tables have data in them.

setBatchMode(true);
setOption("ShowRowNumbers", false);
requires("1.49m");
run("Set Measurements...", "area mean standard min median redirect=None
decimal=3");
run("Input/Output...", "jpeg=85 gif=-1 file=.csv save_column");
print("\\Clear");
run("Clear Results");
ratiovalue = 0;
half = 0;

//Initialize Tables
run("Table...", "name=Points width=400 height=200");
run("Table...", "name=Condensed width=400 height=200");
print("[Points]", "Double, Value, Ratio, Ratio2");
print("[Condensed]", "Number, Ratio, Ratio2");

//Run main function
testfunction();

updateResults;
//Save Tables
selectWindow("Points");
saveAs("Results", "C:\\Users\\tokamoto\\Desktop\\Results_Points.csv");
run("Close");
selectWindow("Condensed");
saveAs("Results", "C:\\Users\\tokamoto\\Desktop\\Results_Condensed.csv");
run("Close");

function testfunction() {
    for (i = 0; i < 10; i++) { 
        for (n = 0; n < 3; n++) { //Create three sets of random data
            setResult("Double", n, (n+1)*2);
            setResult("Value", n, random * 10);
        }
        updateResults();
        //Run the ratio function which separates the data and condenses it into
the two tables
        ratio();
    }
}

function ratio() {
    //Calculate ratio
    ratiovalue = getResult("Double", nResults - 3) / getResult("Value",
nResults - 3);
    half = ratiovalue / 2;
    //Set Results
    setResult("Ratio", 0, ratiovalue);
    setResult("Ratio2", 0, half);
    updateResults();
    //String manipulation and writing to table
    String.resetBuffer;
    String.copyResults;
    String.append(String.paste);
    print("[Points]", replace(String.buffer, "    ", ", "));
    run("Clear Results");

    //Save Condensed results (Just the ratio)
    setResult("Number", nResults, i);
    setResult("Ratio", 0, ratiovalue);
    setResult("Ratio2", 0, half);
    updateResults();
    String.resetBuffer;
    String.copyResults;
    String.append(String.paste);
    print("[Condensed]", replace(String.buffer, "    ", ", "));
    run("Clear Results");
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>