Script to insert file name to title field in file info
Hi all
I need a script that can be run from a batch action that copies the name of the individual file and pastes it into the title field in file info.
Anyone have one?
Thanks
Dave Smith
Hi all
I need a script that can be run from a batch action that copies the name of the individual file and pastes it into the title field in file info.
Anyone have one?
Thanks
Dave Smith
Your thoughts?
By @dcsimages
I haven't tested it, however, I can see that it is also adding a copyright flag and a copyright text line, which you didn't previously mention so the scripts I posted don't include this.
You could try to graft those extra bits of code into the scripts I posted to directly process metadata. Let me know if you hit any roadblocks.
I would not open each JPEG into Photoshop to update metadata, whether it was for 9 or 91,000 images, it's too slow and contributes to minor quality loss. Directly processing the metadata would be my best advice.
Yet another option is to use ExifTool to update the metadata, this would be my tool of choice for 91,000 images as it is CLI based (Windows OS would use double quotes " rather than ' single quotes as used on the Mac):
exiftool -overwrite_original_in_place '-title<${filename;s/\.[^.]*$//}' 'system path to top-level root folder or file'
or
exiftool -overwrite_original_in_place '-title<${filename;s/\.[^.]*$//}' -XMP-xmpRights:Marked=True -Photoshop:CopyrightFlag=True -XMP-dc:Rights='Copyrighted by XXXXXXX' -IFD0:Copyright='Copyrighted by XXXXXXX' -IPTC:CopyrightNotice='Copyrighted by XXXXXXX' 'system path to top-level root folder or file'
Here's another Bridge script, where I have added the copyright flag and string:
// https://imagesimple.wordpress.com/2011/08/24/cs5-filename-to-title-script/
#target bridge
if (BridgeTalk.appName == "bridge") {
FT = MenuElement.create("command", "TEST - Add FileName to Title", "at the end of Tools");
}
FT.onSelect = function () {
AddFilenameToTitle();
}
function AddFilenameToTitle() {
var thumbs = app.document.selections;
if (!thumbs.length) return;
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new
ExternalObject("lib:AdobeXMPScript");
for (var a in thumbs) {
var selectedFile = thumbs[a].spec;
var Title = decodeURI(selectedFile.name).replace(/\.[^\.]+$/, '');
var myXmpFile = new XMPFile(selectedFile.fsName, XMPConst.UNKNOWN,
XMPConst.OPEN_FOR_UPDATE);
var myXmp = myXmpFile.getXMP();
myXmp.deleteProperty(XMPConst.NS_DC, "title");
myXmp.appendArrayItem(XMPConst.NS_DC, "title", Title, 0,
XMPConst.ALIAS_TO_ALT_TEXT);
myXmp.setQualifier(XMPConst.NS_DC, "title[1]",
"http://www.w3.org/XML/1998/namespace", "lang", "x-default");
myXmp.setProperty(XMPConst.NS_XMP_RIGHTS, "Marked", "True");
myXmp.setProperty(XMPConst.NS_DC, "rights", "Copyrighted by XXXXXXX ");
if (myXmpFile.canPutXMP(myXmp)) {
myXmpFile.putXMP(myXmp);
myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
}
}
}Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.