Macro command for renaming results durign saving

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

Macro command for renaming results durign saving

Kashif Zeeshan
Hello,
I want to create a macro to change the name of results as density while
saving them.
Normally, I use the macro as

selectWindow("Results");
saveAs("Text");

Now what should I add now in this code to have the results.xls as
density.xls.
Thanks in advance.

Kashif ZEESHAN
Reply | Threaded
Open this post in threaded view
|

Re: Macro command for renaming results durign saving

Thomas Boudier
Hi Kashif,

Why not rename the file :

File.rename(path1, path2) - Renames, or moves, a file or directory.
Returns "1" (true) if successful. The file or directory must be in the
user's home directory, the ImageJ directory or the temp directory.
Requires 1.38b


Thomas


Kashif Zeeshan a écrit :

> Hello,
> I want to create a macro to change the name of results as density while
> saving them.
> Normally, I use the macro as
>
> selectWindow("Results");
> saveAs("Text");
>
> Now what should I add now in this code to have the results.xls as
> density.xls.
> Thanks in advance.
>
> Kashif ZEESHAN
>
>

--
/*****************************************************/
     Thomas Boudier, MCU Université Paris 6,
     UMR 7101 / IFR 83. Bat A 328, Jussieu.
     Tel : 01 44 27 35 78  Fax : 01 44 27 25 08
/****************************************************/
Reply | Threaded
Open this post in threaded view
|

Re: Macro command for renaming results durign saving

Kashif Zeeshan
Thanks for the reply. I used the following code.

Dir = getDirectory("image");
name = "density.xls";
path = dir+name;

//to save the results, I use the following code now

selectWindow("Results");
saveAs("Measurements", path);

Cordially.

Kashif ZEESHAN

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Thomas
Boudier
Envoyé : lundi 1 septembre 2008 10:56
À : [hidden email]
Objet : Re: Macro command for renaming results durign saving

Hi Kashif,

Why not rename the file :

File.rename(path1, path2) - Renames, or moves, a file or directory.
Returns "1" (true) if successful. The file or directory must be in the
user's home directory, the ImageJ directory or the temp directory.
Requires 1.38b


Thomas


Kashif Zeeshan a écrit :

> Hello,
> I want to create a macro to change the name of results as density while
> saving them.
> Normally, I use the macro as
>
> selectWindow("Results");
> saveAs("Text");
>
> Now what should I add now in this code to have the results.xls as
> density.xls.
> Thanks in advance.
>
> Kashif ZEESHAN
>
>

--
/*****************************************************/
     Thomas Boudier, MCU Université Paris 6,
     UMR 7101 / IFR 83. Bat A 328, Jussieu.
     Tel : 01 44 27 35 78  Fax : 01 44 27 25 08
/****************************************************/