Start renaming list only under certain conditions

Advanced Renamer forum
#1 : 07/04-21 21:50
Axel
Posts: 6
I have a long list of methods.

These should only be processed if certain conditions are fulfilled.

Is this possible?
#2 : 07/04-21 22:19
David Lee
Posts: 1125
Insufficient information!

The provisional answer is probably - if you use a script.
#3 : 13/05-21 15:51
Axel
Posts: 6
Reply to #2:
Hi, sorry - here some information.

I've downloaded some files.

Filename ist e.g. JAHRESSTEUERBESCHEINIGUNG_1234567890_dat20201231_id123456789.pdf

After Advanced Renamer did his job, the filename is 2020-12-31 JAHRESSTEUERBESCHEINIGUNG 1234567890.pdf

In the method list there are 34 methods.

Advanced Renamer was triggerd by a periodic program and after the second run the filename is

1234567890 2020-12-31 JAHRESSTEUERBESCHEINIGUNG.pdf

I want to check at the beginning of the methodlist, if there are "_" in the filename. If not, do nothing.

Is it possible to use as first method a script to check for "_"?
#4 : 14/05-21 08:50
David Lee
Posts: 1125
Reply to #3:
It will be easiest to put the Script method at the end of the batch and revert the flename back to its original value where the original name began with "_"

ie:

if (item.name[0] == '_') return item.name;

#5 : 14/05-21 08:58
David Lee
Posts: 1125
Reply to #4:

Sorry - I misread your specification.

To revert filenames originally containing "_" you need:

if (item.name.includes('_')) return item.name;

edited: 14/05-21 09:00