• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Bridge Template Variable Substitution

New Here ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

When defining a template to set metadata in Bridge, are there any macro-like substitution variables available?  Specifically, I want to set the Title to be the filename of the image file.  Is there a $filename variable or something similar available that I can set as the Title value?

TOPICS
How to , Metadata

Views

242

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

I am not aware of anything similar to this in a metadata template.

 

There are many stand-alone scripts to place the filename in various metadata fields which can be applied to multiple files. If you search the forum you should get many examples.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

LATEST

#target bridge
if(BridgeTalk.appName == 'bridge'){
try{

//create menus
var ftCmd = MenuElement.create('command', 'Filename to Title', 'at the end of Tools');

var ftContCmd = MenuElement.create('command', 'Filename to Title', 'after Thumbnail/Open', this.menuID);
}
catch(e){
alert(e + ' ' + e.line);
}
}

ftCmd.onSelect = function(){
ftAddFilenameToTitle();
}

ftContCmd.onSelect = function(){
ftAddFilenameToTitle();
}

function ftAddFilenameToTitle(){
try{
var ftThumbs = app.document.selections; //get selected thumbnails
if (!ftThumbs.length) return; //nothing selected
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
for(var a in ftThumbs){ //loop through thumbs
var ftTitle = ftThumbs[a].name; //get filename
//remove filename after last dash character


//to remove filename after dash, uncomment lines
//~ ftTitle = ftTitle.split('-');
//~ if(ftTitle.length > 1){
//~ ftTitle.length--;
//~ }
//~ ftTitle = ftTitle.join('-');


//remove filename after last period character
ftTitle = ftTitle.split('.');
if(ftTitle.length > 1){
ftTitle.length--;
}
ftTitle = ftTitle.join('.');
var ftMeta = ftThumbs[a].synchronousMetadata;
var ftXMP = new XMPMeta(ftMeta.serialize());
ftXMP.deleteProperty(XMPConst.NS_DC, 'title'); //delete old title
ftXMP.appendArrayItem(XMPConst.NS_DC, 'title', ftTitle, 0, XMPConst.ALIAS_TO_ALT_TEXT); //write new title
ftXMP.setQualifier(XMPConst.NS_DC, 'title[1]', 'http://www.w3.org/XML/1998/namespace', 'lang', 'x-default');
var ftUpdatedPacket = ftXMP.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
ftThumbs[a].metadata = new Metadata(ftUpdatedPacket); //write to file
}
}
catch(e){
alert(e + ' ' + e.line);
}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines