Copy link to clipboard
Copied
I'm looking for a script for copying the filename of a tiff to the description in that same file's iptc, with a couple of contextual changes to the name.
Those changes are:
replace any = with :
replace any * with /
add the prefix "CMS:"
So here's an example:
input
filename: 87*37=6.tif
description:
output
filename: 87*37=6.tif
description: CMS:87/37:6
I had a script that did some of these things for a while, but it was quite slow and I don't know how to rewrite it.
Thank you in advance for any help,
Lewis
Copy link to clipboard
Copied
This is the same script as before with an extra line to change the asterisk..
#target bridge
if( BridgeTalk.appName == "bridge" ) {
FileNameToDesc = MenuElement.create("command", "Add FileName to Description", "at the end of Thumbnail");
}
FileNameToDesc.onSelect = function () {
updateFileName();
}
function updateFileName(){
loadXMPLib();
var Prefix = "CMS:";
var sels = app.document.selections;
for(var a in sels){
var thumb = new Thumbnail(sels);
if(thumb.hasMetadata){
var selectedFile = thumb.spec;
var myXmpFile = new XMPFi...
.name).replace(/\.[^\.]+$/, '');
Name = Name.replace(/\*/g,'/');
Name = Prefix + Name.re...