Re: very simple question about rename macro

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: very simple question about rename macro

Schebique
Hi.

It is better to use really powerful batch renaming tool of Total Commander.
In linux I use Krename succesfully.

In macro you will need to split the original name, replace respective part
with desired string and reconstruct the file name using for cycle.
Example:

title="z0000_t0000.tif;
parts=split(title, "_");
parts[0]="img1";
name=parts[0];
for (p=1; p<parts.length; p++) {
   name = name+"_"+parts[p];
}
print(name);

Or you can use function replace:
name=replace(title, "z0000_", "img1");

hope this helps a little.
Ondřej.
Dne 8.7.2016 11:37 "inesica" <[hidden email]> napsal(a):

> Hello,
>
> I have a very very simple question. I would like to rename my files and  I
> have the corresponding program. In the process of renaming my files, i
> would
> like one part of the original name to stay the same: for ex. the name is
> z0000_t0005, with the program it becomes z0000_t0004, but instead of
> writing
>
> name = "z0000_" + "t" + IJ.pad( number, 4 ) + ".tif";
>
> I would like to replace "z0000_" with something that would say that the
> values of the original name from 1 to 6 should remain the same in my new
> name function.
>
> How could I do that?
> Thank you very much.
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/very-simple-question-about-rename-macro-tp5016831.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