help writing a renaming script?

Advanced Renamer forum
#1 : 24/07-13 01:12
Henri
Henri
Posts: 1
hey there!
some help appreciated for doing a name replacing script.

i have a bunch of files named something like this:

asdasd_c3_asdasd
asd_asdasd_f#5_asdasd
asdasd_a3_asd_asdasd

you may know that the a3 and f#5 etc are note names, and im looking for a way to replace each one with one that is a semitone lower as in:

asdasd_b2_asdasd
asd_asdasd_f5_asdasd
asdasd_g#3_asd_asdasd

i think i need to do to lists that contains all the note values, and then have the script look at the filenames, and then reference if it can find a corresponding string in the list, then change that into one thats one step forward in the list.

the note values go like this, for your reference

c3, c#3, d3, d#3, e3, f3, f#3, g3, g#3, a3, a#3, b3, c4, c#4, d4, etc.

any ideas oh how i should go about doing this?

i already know that i could do this by manually entering a crap ton of replace naming methods, but id like to learn how to use the script feature to do this, also would make changing things easier if there needs to be changes made.

thanks!

h


24/07-13 01:12 - edited 24/07-13 01:14
#2 : 31/07-13 09:43
Kim Jensen
Kim Jensen
Administrator
Posts: 870
Reply to #1:
Try to download and load this method preset containing a script:
http://www.advancedrenamer.com/down/forum/notes .aren

When loaded you can click the Pre Batch Script button to configure all the individual notes. You should get the idea of the syntax.

This is what the script does:
The filename is split into parts divided by _. It then runs through every part of the filename to check if it is listed in the nodes array. If it is a note it will replace the part with the note that comes before the found note, unless it is the first note in the list. In the end the filename is put together again with _ as the part divider.

I hope this works for you.


31/07-13 09:43