Copy link to clipboard
Copied
Hello,
Apologies if this isn't the correct forum to ask this question:
I am currently using the DAM Filename to Title script with Bridge CS4 - http://www.damuseful.com/pages/PimpMyBridge.html - to get the filename into the IPTC title script. This however puts in the extension into the title field also. So a JPG file named 2000 ends up with 2000.JPG in its Title field. I wish to not have the extension appear in the Title field.
Is this possible by modifying the DAM script / using any other freely available script.
In case it helps, this is what the DAM script currently looks like:
#target bridge
if ( BridgeTalk.appName = "bridge" )
//-----------------------------------------------------------------------
//This script copies selected thumbnails' filenames to the title field
//Also shows how to add menu items
//The AdobeLibrary scripts must be loaded
//This script was created by John Beardsworth www.beardsworth.co.uk/ and modified by Peter Krogh www.DAMuseful.com
//This script may be freely distributed and modified
//--------------------------------------------------------------------
// Let's create our menu
var menu = MenuElement.create( "command", "Write Filename to IPTC Title Field", "at the end of Tools");
menu.onSelect = function(m)
{
var getFolderChildren = true ;
var filesOnly = true ;
var thumbs = getBridgeThumbnails ( TYPES.PHOTOSHOP_OPENABLE, getFolderChildren, filesOnly) ;
for ( var i = 0; i < thumbs.length; i++ )
{ thumb = thumbs;
md = thumb.synchronousMetadata;
md.namespace ="http://ns.adobe.com/photoshop/1.0/";
md.Title = thumb.name;
}
Window.alert ("Done " + i + " records");
};
There are also 3 other Adobe Library scripts that come with the download.
I know absolutely nothing about scripting, so baby-steps would be appreciated.
Many thanks.
Change:
md.Title = thumb.name;
To:
md.Title = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');
Copy link to clipboard
Copied
Change:
md.Title = thumb.name;
To:
md.Title = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');
Copy link to clipboard
Copied
Thanks Paul, this works beautifully
Copy link to clipboard
Copied
I'll add my thanks as well. Works in Bridge CC 2017.
Gene
Copy link to clipboard
Copied
Any idea how to modify this for writing to a .wav file?
Copy link to clipboard
Copied
Can a WAV file store metadata? If so, it would use the same process.
I use a slightly different script, there are multiple ways to get a list of files, multiple ways to remove parts of the name, and multiple ways to write metadata back to files:
----------------------
#target bridge
if(BridgeTalk.appName == "bridge"){
FT = MenuElement.create("command", "Add Part Number 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.spec;
var Title = selectedFile.name;
Title = Title.split('.');
if(Title.length > 1){
Title.length--;
}
Title = Title.join('.');
var md = thumbs.synchronousMetadata;
var xmp = new XMPMeta(md.serialize());
xmp.deleteProperty(XMPConst.NS_DC, "title");
xmp.appendArrayItem(XMPConst.NS_DC, "title", Title, 0, XMPConst.ALIAS_TO_ALT_TEXT);
xmp.setQualifier(XMPConst.NS_DC, "title[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
var updatedPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
thumbs.metadata = new Metadata(updatedPacket);
}
}
-------------------------