how to use an other attribute if one is not available?

Advanced Renamer forum
#1 : 13/07-24 01:40
Schowalter
Schowalter
Posts: 6
Hello,
I want to rename thousand of image-files. But there are different filetypes, and not all of them support the <Img DateOriginal>.

So I would like to rename like following:

if <Img DateOriginal> is available the new filename should be:

<Img DateOriginal:yyyy-mm-dd><Img TimeOriginal:hh-nn-ss>_<name>

if not the following should be used:
<Date Modified:yyyy-mm-dd>_<Time Modified:hh-nn-ss>_<name>

How can I achive this?
It is important that there are no "_" at the beginning of the filename, if <Img DateOriginal> is not available.

Thank you for your help!


13/07-24 01:40 - edited 13/07-24 01:41
#2 : 13/07-24 07:02
Delta Foxtrot
Delta Foxtrot
Posts: 285
Reply to #1:

Hi Showalter,

See if this works for you:

Script method, main script:

if (app.parseTags('<Img DateOriginal>')) {
return app.parseTags('<Img DateOriginal:yyyy-mm-dd>') + "_" + app.parseTags('<Img TimeOriginal:hh-nn-ss>') + "_" + app.parseTags('<Name>') ;
} else {
return app.parseTags('<Date Modified:yyyy-mm-dd>') + "_" + app.parseTags('<Time Modified:hh-nn-ss>') + "_" + app.parseTags('<Name>') ;
}


-------------------------
By the way, I basically copied this from a David Lee script that I searched out using the search term "date script", then substituted the tags you used.

Best,
DF


13/07-24 07:02
#3 : 13/07-24 08:04
Schowalter
Schowalter
Posts: 6
Reply to #2:
Hi DF,
what a great help from you. I was not so familiar to find this on my own....
It works perfektly!

Thank you very much!
Whish you a blessed day!
kani


13/07-24 08:04