save results table as csv with custom name

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

save results table as csv with custom name

Daniyard
Dear all,

I am just writing a macro. The purpose is to save multipoint selection coordiantes in a csv file using the name of the image. it dows what I want until the point that it saves either as a fixed name.csv or just as the image title but with no extension. The following macro I used (I found parts of this macro also here in the forum):

run("Measure");
name = getTitle;
dotIndex = indexOf(name, ".");
name = substring(name, 0, dotIndex);
saveAs("Results", getDirectory("home") +name);


Thanks a lot.

Daniyard
Reply | Threaded
Open this post in threaded view
|

Re: save results table as csv with custom name

Christine Labno-2
Dear Daniyard,

The "getDirectory" command will ask you where you want to save each time, instead of automatically saving to a particular folder.  If this is what you want to do, then this slightly modified version of your code should take care of the saving without an extension problem.


dir = getDirectory("choose where to save");
run("Measure");
name = getTitle;
dotIndex = indexOf(name, ".");
name = substring(name, 0, dotIndex);
saveAs("Results",  dir + name + ".csv");


Hope that at least gets you pointed in the right direction.

Best,
Christine
--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Daniyard [[hidden email]]
Sent: Thursday, June 13, 2013 6:19 AM
To: [hidden email]
Subject: save results table as csv with custom name

Dear all,

I am just writing a macro. The purpose is to save multipoint selection
coordiantes in a csv file using the name of the image. it dows what I want
until the point that it saves either as a fixed name.csv or just as the
image title but with no extension. The following macro I used (I found parts
of this macro also here in the forum):

run("Measure");
name = getTitle;
dotIndex = indexOf(name, ".");
name = substring(name, 0, dotIndex);
saveAs("Results", getDirectory("home") +name);


Thanks a lot.

Daniyard



--
View this message in context: http://imagej.1557.x6.nabble.com/save-results-table-as-csv-with-custom-name-tp5003427.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: save results table as csv with custom name

Daniyard
Dear Christine,

Thank you very mch...now it works as it should!

Cheers,

Daniel