how to use an other attribute if one is not available?
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!
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!
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
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
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
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