Problem with automatic saves in a macro.

Posted by Goldsmith, Noel on
URL: http://imagej.273.s1.nabble.com/Problem-with-automatic-saves-in-a-macro-tp3693854.html

Hi,
I am (have) written a macro which selects part of an image and then analyzes
particles and then saves the data file, and then repeats on another part of
the image.
 The macro runs, but saves nothing. No file anywhere that I can find. Also
no errors.
I have worked around the problem for the job at hand by instituting a manual
save at the end of all the analyze particle operations by leaving out clear
in the set measurements dialog. Which in fact is better for my work anyway
but... It should work.

Here is a version that runs but saves nothing.

I am running 1.42g on an Intel Macpro running 10.5.5 or 10.5.6.
This is the macro, cut down to keep it simple.. And I changed the path to
the desktop, as was used in the examples.


xl=10;
wi=0;
yt=0;
for (i=0;i<11; i+=1) {
xl=10+i*34;
wi=34;
yt=0;
directory= "/Users/goldsmin/desktop/";
name="col" +toString(i)+".txt";
path="["+directory+name+"]";
makeRectangle(xl,yt,wi,2048);
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing clear display include record");
saveAs("measurements", path);
}


If anyone can tell me what stupidity I  am committing I will be grateful.
Thank you.

PS the example macro "ArgumentPassingDemo

// This macro demonstrates how to use string concatenation to
// pass  variables  to commands called using the run() function.
// It creates an image, sets the scale to 150 pixels/mm, rotates
// 25 degrees, and saves in Analyze format. Note that the file
// path must be enclosed in brackets because of the space in
// the image name.

name = "Test Image";
directory = "/Users/wayne/Desktop/";
width = 400;
height = 300;
scale = 150; // 150 pixels/mm
unit = "mm";
angle = 25;
newImage(name, "8-bit ramp", width, height, 1);
run("Set Scale...", "distance="+scale+" known=1 pixel=1 unit="+unit);
run("Arbitrarily...", "interpolate  angle="+angle);
path = "["+ directory +name+"]";
run("Analyze Writer", "save="+path);

Will not finish, it objects about Analyze Writer. Which I couldn't find
anywhere.
I confess to being puzzled.




Noel Goldsmith
Air Vehicles Division
Defence Science and Technology Organisation
506 Lorimer Street Port Melbourne Vic 3207
Ph 03 96267527 Fax 03 96267089
Mobile 0428364003
[hidden email]



IMPORTANT: This email remains the property of the Australian Defence Organisation and is subject to the jurisdiction of section 70 of the CRIMES ACT 1914.  If you have received this email in error, you are requested to contact the sender and delete the email.