Saving window with modified filename

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

Saving window with modified filename

Ernest Heimsath
Hello all,

I am working on a macro and would like to save a selected window with a
modified version of its filename that retains the last xx digits of that
filename. For example...

current filename:

"failed experiment start over_02.nd2 - Image 10 #09"

save to:

"failed experiment start over_02_09.tif

I am stumbling through developing macros for the firs time, so any help
would be greatly appreciated.

Thanks!

Ernest



--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: Saving window with modified filename

Philippe CARL
Dear Ernest,
The following macro code should solve your issue:
        str = "failed experiment start over_02.nd2 - Image 10 #09";
        print(substring(str, 0, 31) + "_" + substring(str, lengthOf(str) - 2, lengthOf(str)) + ".tif");
My best regards,
Philippe

Le Mercredi 15 Août 2018 20:18 CEST, Ernest Heimsath <[hidden email]> a écrit:

> Hello all,
>
> I am working on a macro and would like to save a selected window with a
> modified version of its filename that retains the last xx digits of that
> filename. For example...
>
> current filename:
>
> "failed experiment start over_02.nd2 - Image 10 #09"
>
> save to:
>
> "failed experiment start over_02_09.tif
>
> I am stumbling through developing macros for the firs time, so any help
> would be greatly appreciated.
>
> Thanks!
>
> Ernest
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html





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