opw62
1
I have the following button:
@nodeselect
filetype new .txt newname "norename:{file|noext}.txt"
Resulting in:
DSCN5394.JPG
DSCN5394.txt
Is there a way to expand this so it will shooting date?
As a long shot I tried:
filetype new .txt newname "norename:{file|noext}{shootingtime|D#yyyyMMdd}.txt"
but that didn't work.
Thanks.
Leo
3
Download this and drag it to your toolbar while in Customize mode:
New .TXT Shooting Date.dcf (1.8 KB)
For reference, here's the script code inside it:
function OnClick(clickData)
{
var cmd = clickData.func.command;
cmd.ClearFiles();
for (var eSel = new Enumerator(clickData.func.sourcetab.selected); !eSel.atEnd(); eSel.moveNext())
{
var item = eSel.item();
if (!item.is_dir)
{
var newName = item.name_stem_m;
var imageMeta = item.metadata.image;
if (imageMeta != null)
{
var dateTaken = imageMeta.datetaken;
if (dateTaken != null)
{
newName += dateTaken.Format('D#yyyyMMdd');
}
}
var cmdLine = 'FileType NEW=".txt" NEWNAME="norename:' + newName + '.txt"';
cmd.RunCommand(cmdLine);
}
}
}
opw62
4
Waow, many thanks.
One last thing, would it be possible to add a space between file name and date?
Right now this is the situation:
DSC00146.JPG te become
DSC0014620150429.txt
If possible the new name would read:
DSC00146 20150429.txt
So I can re-date the file after date in file name, for which action I have a separate button.
Leo
5
Change
newName += dateTaken.Format('D#yyyyMMdd');
to
newName += " " + dateTaken.Format('D#yyyyMMdd');
opw62
6
Super!
Thank you very much.
Had no clue where and how to add the space myself.