How to rename according to a loop or pattern ?

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

How to rename according to a loop or pattern ?

Postby stephaud » Wed Feb 01, 2017 12:12 pm

Hi !
First of all i've no skill into Javascript and english is not my language ! So be indulgent... :)

Well, i would like to rename a bunch of files like this :
what i have > tile_00001.jpg, tile_00002.jpg... up to tile_00153.jpg
renamed in > tile_x=001&y=001.jpg, tile_x=001&y=002.jpg... up to tile_x=001&y=153.jpg
AND After that
tile_00154.jpg, tile_00155.jpg... up to tile_00306.jpg
renamed in > tile_x=002&y=001.jpg, tile_x=002&y=002.jpg... up to tile_x=002&y=153.jpg
AND so on... (every 153 th)

In another way to say it, i want :
X=001 and Y=001....to.... Y=153
and
X=002 and Y=001...to...Y=153
and
X=003 and Y=001...to...Y=153
and so on...

Does someone can help me ?
Thanks.
stephaud
 
Posts: 7
Joined: Tue Jan 31, 2017 3:51 pm

Re: How to rename according to a loop or pattern ?

Postby Admin » Thu Feb 02, 2017 11:34 pm

This would require some a bit of Javascript programming....

First read counter after "tile_"
Store counter in variable COUNTER
Replace then counter in name with x=(COUNTER/153)+1&y=(COUNTER%153)

COUNTER%153 means the % Modulus Operator, that is the remainder of after an integer division
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: How to rename according to a loop or pattern ?

Postby stephaud » Wed Feb 08, 2017 12:03 pm

Thanks for your answer, i would have to find time to jump into javascript ;)
I've done it with another sofware called "ReNamer", with adding rules... (simpler for a newbie like me into javascripts)
stephaud
 
Posts: 7
Joined: Tue Jan 31, 2017 3:51 pm


Return to Javascript Renaming