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

Copy Filename to IPTC Keywords

New Here ,
Jun 09, 2010 Jun 09, 2010

Copy link to clipboard

Copied

Hi all,

I'd like to copy filename to keywords. I've read this forum but I can't find a solution to my case.. So if someone could help me and tell me how to do that I'll be very happy. I don't have any javascript skills, so if someone would push me forward, that'll be nice.

I'm using Bridge CS3, MacOS 10.5.8. I'd like to use it with Automator, or if someone has better solution, please let me know.

Thanks,

Pete

TOPICS
Scripting

Views

14.4K

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

correct answers 1 Correct answer

Valorous Hero , Jun 09, 2010 Jun 09, 2010

This will put the filename only no extension..


#target bridge
addNametoMeta = {};
addNametoMeta.execute = function(){
  var sels = app.document.selections;
  for (var i = 0; i < sels.length; i++){
var md = sels.synchronousMetadata;
    md.namespace = "http://ns.adobe.com/photoshop/1.0/";
    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');
    md.Keywords = md.Keywords + ";" + Name;
  }
}
if (BridgeTalk.appName == "bridge"){
var menu = MenuElement.create( "command", "Save Filename in Keyw

...

Votes

Translate

Translate
Valorous Hero ,
Aug 17, 2011 Aug 17, 2011

Copy link to clipboard

Copied

This should do it, hope it works for you..

#target bridge
addFolderNametoMeta = {};
addFolderNametoMeta.execute = function(){
  var sels = app.document.selections;
  for (var i = 0; i < sels.length; i++){
var md = sels.synchronousMetadata;
    md.namespace = "http://ns.adobe.com/photoshop/1.0/";
    md.Keywords = md.Keywords + ";" + decodeURI(sels.spec.name).substring(0,7);;
  }
}
if (BridgeTalk.appName == "bridge"){
var menu = MenuElement.create( "command", "Add First 7 to Keywords", "at the end of Tools");
  menu.onSelect = addFolderNametoMeta.execute;
}

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
New Here ,
Apr 16, 2012 Apr 16, 2012

Copy link to clipboard

Copied

Wonderful. I've been searching hi and lo for the solution to my problem. This is getting very close. I have a need of a slight modification: Getting back to the basic request of "filename to IPTC Title", I want to put the filename into my OWN datafield that is NOT IPTC. I'm wondering where in this code I can apply my own namespace and datafield name, and if it would work with that simple change, or would I need to modify the Adobe libraries as well?

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
Valorous Hero ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

See if this helps....

#target bridge  

   if( BridgeTalk.appName == "bridge" ) { 

addFileName = MenuElement.create("command", "Add FileName to My New Field", "at the end of Tools");

}

addFileName.onSelect = function() {

if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

//Your unique name space

var psNamespace = "http://my.uniqueNameSapce/1.0/";

//Your chosen prefix

var psPrefix = "myPre:";

//Register namespace and prefix

XMPMeta.registerNamespace(psNamespace, psPrefix);

var sels =  app.document.selections;

for(var a in sels){

            var thumb = sels;

            if(thumb.type != 'file') continue;

            app.synchronousMode = true;

            var xmp = new XMPMeta(thumb.synchronousMetadata.serialize());   

            var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');

            //Create new field  "MyTitile" add file name to it.

            xmp.setProperty( psNamespace, "MyTitle", Name);

            var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);

            thumb.metadata = new Metadata(newPacket);

            }

}

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
Explorer ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Like everyone else I need to use this to address thousands of images, and what has been suggested works as it is in Bridge CC 2017. However, I also need a tweak. Would it possible to modify the original script so that it only captures the first 8 characters of the file name?

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
Explorer ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

WHOOT! Figured it out myself. So, what I have is my company's product images that are named by style number and then color code and then pose mnemonic plus file extension. So, I have 12345678Color-main where 12345678 is the number, Color cab be anything from 3 characters to 12 characters and "-main" specifies it is the primary image to be used in print and web presentations. In our DAM system (Canto Flight) I have to be able to search on just the numerical portion of the image. But, Flight not find the numerical string when it runs in to the color name. So I need to add just the numerical portion of the file name to the Keywords field. This is what I modified it to in Bridge CC2017;

#target bridge

addNametoMeta = {};

addNametoMeta.execute = function(){

  var sels = app.document.selections;

  for (var i = 0; i < sels.length; i++){

var md = sels.synchronousMetadata;

    md.namespace = "http://ns.adobe.com/photoshop/1.0/";

    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');

    md.Keywords = md.Keywords + ";" + Name.substring(0,8);

  }

}

if (BridgeTalk.appName == "bridge"){

var menu = MenuElement.create( "command", "Save Filename in Keywords", "at the end of Tools");

  menu.onSelect = addNametoMeta.execute;

}

Works like a charm!

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
Guide ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Here you are:-

#target bridge  

addNametoMeta = {};  

addNametoMeta.execute = function(){  

  var sels = app.document.selections;  

  for (var i = 0; i < sels.length; i++){  

var md = sels.synchronousMetadata;  

    md.namespace = "http://ns.adobe.com/photoshop/1.0/";  

    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '').match(/^.{8}/);

    md.Keywords = md.Keywords + ";" + Name;  

  }  

}  

if (BridgeTalk.appName == "bridge"){  

var menu = MenuElement.create( "command", "Save Filename in Keywords", "at the end of Tools");  

  menu.onSelect = addNametoMeta.execute;  

}

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
Explorer ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Thanks for the reply SuperMerlin. I appreciate the input even I came up with a solution on my own. But, I will keep your script handy just in case mine blows up down the 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
Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

You guys are a bunch of geniuses...  love this thread!!!

I have filenames like this  Tab_Deep Photo_N252_9c CP and I was hoping to insert a GREP where it grabs the file name and copies it into Keywords like this:  Tab Deep Photo N252 9c CP

No underscores.  Possible?

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
Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

I should add that I am in Bridge only, facing hundreds of snippet thumbnails that need copying Filename to Keywords.   I've been doing it by hand -- and boy am I sore.

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
Community Expert ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

I can do this with the command line interface driven ExifTool using a regular expression search with a replace using a word spaceAs a start, the code to enter into Terminal.app on the Mac OS would be:

exiftool -r -overwrite_original '-subject<${filename;s/\.[^\.]+$|_/ /g}' 'PATHtoFILEorDIRECTORY'

While for MS Windows Command Prompt:

exiftool -r -overwrite_original "-subject<${filename;s/\.[^\.]+$|_/ /g}" "PATHtoFILEorDIRECTORY"

Use at your own risk – work on copies of the original files for testing.

Note: I am not 100% happy with the regex search pattern, as it leaves a trailing white space where the filename extension used to be (however that may not be the end of the world and I’ll try to fix that up if I can).

P.S. I have only had partial success hacking a Bridge script, the regular expression in JavaScript appears to be a little bit different with the /g global option and I don’t now scripting, so bluffing my way through is not working!

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
Community Expert ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

OK, I worked it out – the regex structure is a little different between Perl and JavaScript… anyway here it is, appending the filename without any extension or underscores to existing keywords (either IPTC:Keywords or DC:Subject).

// https://forums.adobe.com/thread/656144

// https://forums.adobe.com/message/9744916

// https://forums.adobe.com/message/9745231

#target bridge

addNametoMeta = {};

addNametoMeta.execute = function(){

  var sels = app.document.selections;

  for (var i = 0; i < sels.length; i++){

var md = sels.synchronousMetadata;

    md.namespace = "http://ns.adobe.com/photoshop/1.0/";

    var Name = decodeURI(sels.name).replace(/\.[^\.]+$|_/g, ' '); //remove extension | remove underscores

    md.Keywords = md.Keywords + ";" + Name;

  }

}

if (BridgeTalk.appName == "bridge"){

var menu = MenuElement.create( "command", "Filename to Keywords - Removing Underscore", "at the end of Tools");

  menu.onSelect = addNametoMeta.execute;

}

Quit Bridge. When you copy the 18 lines of source code, ensure that any quotes are straight and not curly. Save from a plain text editor or ExtendScript Toolkit with a .jsx extension and place in your Bridge Startup Scripts folder (use the preferences menu, startup scripts – reveal startup scripts). Then restart Bridge, enabling the script when prompted. Then select the files and go to the Tools menu and look for “Filename to Keywords - Removing Underscore”.

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
Participant ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

I almost wet myself, that was so incredibly good, Stephen !!!

Wwwwwwow!   I cannot believe how much I will get done today.   I have thousands of snippets to apply this too.   I had been doing by hand for 2 weeks.  But now, now I am going to get a lunch break.

A hundred thank you's, Stephen.

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
Community Expert ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

I almost wet myself, that was so incredibly good, Stephen !!!

Wwwwwwow!   I cannot believe how much I will get done today.   I have thousands of snippets to apply this too.   I had been doing by hand for 2 weeks.  But now, now I am going to get a lunch break.

A hundred thank you's, Stephen.

Thanks for the thanks!

It only takes me a couple of minutes or less to work out how to do this stuff in ExifTool, however when it comes to scripting it takes a lot longer (if I can even do it in the first place, usually I need to rely on the good will of others). So for personal use, I just use ExifTool.

My contribution was very small, I can’t write script – however I can sometimes hack them. In this case it was just a matter or working out how to adjust the Perl regular expression syntax into JavaScript and making a few other minor changes.

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
Participant ,
Aug 05, 2017 Aug 05, 2017

Copy link to clipboard

Copied

Fantastic tip, Stephen.   I really appreciated everyone's help on this thread.  I really do.

I have some corruption in my snippets, then, because I threw the book at trying to force-feed some of the fields (I discovered the Metadata Template trick, too).  Some took it, others complained.   It's like life !!

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
New Here ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

These tips are wonderful for those of us for whom metadata and javascript are deep mysteries. I was able to get Paul's script below to work as advertised. How can it be tweaked so that instead of appending the file name to Keywords, it replaces the contents of Description with the file name? Thanks in advance!

  1. #target bridge  
  2. addNametoMeta = {};  
  3. addNametoMeta.execute = function(){  
  4.   var sels = app.document.selections;  
  5.   for (var i = 0; i < sels.length; i++){  
  6. var md = sels.synchronousMetadata;  
  7.     md.namespace = "http://ns.adobe.com/photoshop/1.0/";  
  8.     var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, ''); 
  9.     md.Keywords = md.Keywords + ";" + Name;  
  10.   }  
  11. }  
  12. if (BridgeTalk.appName == "bridge"){  
  13. var menu = MenuElement.create( "command", "Save Filename in Keywords", "at the end of Tools");  
  14.   menu.onSelect = addNametoMeta.execute;  

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
Guide ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

#target bridge  

   if( BridgeTalk.appName == "bridge" ) { 

fileToDesc = MenuElement.create("command", "Add FileName to Description", "at the end of Tools");

}

fileToDesc.onSelect  = function () {  

var thumbs = app.document.selections;

if (ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

for(var a =0;a<thumbs.length;a++){

var selectedFile =  new Thumbnail(thumbs);   

app.synchronousMode = true;

var xmp = new XMPMeta(selectedFile.synchronousMetadata.serialize());

xmp.deleteProperty(XMPConst.NS_DC, "description");

xmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", decodeURI(selectedFile.spec.name).replace(/\..+$/,""));

var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);

selectedFile.metadata = new Metadata(newPacket);

    }

};

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
New Here ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

Thank you, SuperMerlin. Now, however, I've discovered that I thought the backend where I'm posting these images to galleries was pulling from the Title field to assign captions to images in the gallery. Apparently not so; it's using the Headline IPTC field as the caption. My attempts to create an analogous script to modify the Headline field have failed. Is this just not supported in Bridge? I am very much a rookie with all of this. Thanks.

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
Community Expert ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

Try the following code edit hack:

// https://forums.adobe.com/thread/656144

// https://forums.adobe.com/message/10472542#10472542

#target bridge  

  if( BridgeTalk.appName == "bridge" ) {  

fileToDesc = MenuElement.create("command", "Add FileName to Headline", "at the end of Tools");

}

fileToDesc.onSelect  = function () {  

var thumbs = app.document.selections;

if (ExternalObject.AdobeXMPScript == undefined)  ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

for(var a =0;a<thumbs.length;a++){

var selectedFile =  new Thumbnail(thumbs);    

app.synchronousMode = true;

var xmp = new XMPMeta(selectedFile.synchronousMetadata.serialize());

xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "Headline");

xmp.setLocalizedText(XMPConst.NS_PHOTOSHOP, "Headline", null, "x-default", decodeURI(selectedFile.spec.name).replace(/\..+$/,""));

var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);

selectedFile.metadata = new Metadata(newPacket);

    }

};

Note if there is existing photoshop:Headline data in the file:

• Existing XMP Headline metadata will be overwritten

• Existing IPTC Headline metadata will NOT be overwritten

Keep in mind that this is not the same as IPTC Headline data, so this code hack is only partly correct. When using Bridge to manually write Headline data, it is written to both the photoshop:Headline (xmp) field and to the IPTC:Headline field, so my code edit is somewhat lacking as it only addresses 1 of 2 locations.

SuperMerlin to the rescue?!

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
Community Expert ,
Jun 28, 2018 Jun 28, 2018

Copy link to clipboard

Copied

Not sure what is going on here… The script is writing the edited filename without extension which is visible in the metadata panel, but not in File Info. Tested in both CS6 and CC2018 with the same behaviour:

meta-madness.png

This must be the previously mentioned difference between Photoshop XMP and IPTC variants of this field?

Using the GUI, Bridge writes metadata to both XMP and IPTC (verified using ExifTool), this data is visible in File Info.

Using my hack to the script, the script is only writing data to XMP (verified using ExifTool) – however this is not visible in File Info.

If I used ExifTool to update the IPTC:Headline tag from the Photoshop:Headline tag, then this is also visible in File Info.

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
Community Expert ,
Jul 01, 2018 Jul 01, 2018

Copy link to clipboard

Copied

If the hack to the script that adds the filename to the XMP Headline metadata field is not recognised by your web software, then you will need to add it to IPTC Headline… Which I have not yet figured out.

As an alternative – I would use the following ExifTool command to delete any existing content and add new content recursively to all files or subfolders under the specified top level path:

exiftool -XMP-photoshop:Headline= -XMP-photoshop:Headline='my new manual headline entry' -IPTC:Headline= -IPTC:Headline='my new manual headline entry' -r 'path to file or folder'

To copy the filename without extension, replacing existing Photoshop XMP and IPTC Headline content:

exiftool -XMP-photoshop:Headline= '-XMP-photoshop:Headline<${filename;s/\.[^.]*$//}' -IPTC:Headline= '-IPTC:Headline<${filename;s/\.[^.]*$//}' -r 'path to file or folder'

Windows users would swap the single straight quotes for double straight quotes. More info can be supplied if required (such as how to remove the backup _original file, ignoring specific file formats or sub-directories etc).

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
Community Expert ,
Jul 05, 2018 Jul 05, 2018

Copy link to clipboard

Copied

OK, standing on the shoulders of giants – fingers crossed that this code hack works as intended…  Tested on Mac CS6 and CC2018 + Win CC2018:

// https://forums.adobe.com/thread/656144

// https://forums.adobe.com/message/9744916

// https://forums.adobe.com/message/9745231

#target bridge

addNametoMeta = {};

addNametoMeta.execute = function(){

  var sels = app.document.selections;

  for (var i = 0; i < sels.length; i++){

var md = sels.synchronousMetadata;

    md.namespace = "http://ns.adobe.com/photoshop/1.0/";

    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/g, ' '); //remove extension

    md.Headline = md.Headline + Name;

  }

}

if (BridgeTalk.appName == "bridge"){

var menu = MenuElement.create( "command", "Filename to XMP and IPTC Headline", "at the end of Tools");

  menu.onSelect = addNametoMeta.execute;

}

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
New Here ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

Hi,

I am trying to create an Adobe Bridge 2018 script to "Prepend filename to the Description".

#target bridge 

addNametoMeta = {}; 

addNametoMeta.execute = function(){ 

  var sels = app.document.selections; 

  for (var i = 0; i < sels.length; i++){ 

var md = sels.synchronousMetadata; 

    md.namespace = "http://ns.adobe.com/photoshop/1.0/"; 

    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');

    md.Caption = md.Caption + Name; 

  } 

if (BridgeTalk.appName == "bridge"){ 

var menu = MenuElement.create( "command", "Prepend Filename to description", "at the end of Tools"); 

  menu.onSelect = addNametoMeta.execute; 

}

Have tried: md.Description = md.Description + Name; 

Would like: md.Description = md.Description + " " + Name; 

Any suggestions out there ????

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
Community Expert ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

stephend54917218​ – Try this code to prefix the filename without extension separated by a word space before an existing entry in the description metadata:

// https://forums.adobe.com/thread/2009311

// https://forums.adobe.com/message/10537059#10537059

#target bridge  

  if( BridgeTalk.appName == "bridge" ) {

FT = MenuElement.create("command", "Add FileName Prefix to Description", "at the end of Tools");

}

FT.onSelect = function () {

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 FileName = decodeURI(selectedFile.name).replace(/\.[^\.]+$/, '')

      var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);

  var myXmp = myXmpFile.getXMP();

var Desc=[];

var count =  myXmp.countArrayItems(XMPConst.NS_DC, "description");

for(var i = 1;i <= count;i++){

Desc.push(myXmp.getArrayItem(XMPConst.NS_DC, "description", i));

    }

Desc=FileName.toString() + " " + Desc;

        myXmp.deleteProperty(XMPConst.NS_DC, "description");

        myXmp.appendArrayItem(XMPConst.NS_DC, "description", Desc, 0, XMPConst.ALIAS_TO_ALT_TEXT);

        myXmp.setQualifier(XMPConst.NS_DC, "description[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");

        if (myXmpFile.canPutXMP(myXmp)) {

        myXmpFile.putXMP(myXmp);

        myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);

        }

    }

}

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
Community Expert ,
Aug 02, 2018 Aug 02, 2018

Copy link to clipboard

Copied

And another version based off the original code:

#target bridge

// https://forums.adobe.com/message/10537060#10537060

prefixNametoDescMeta = {};

prefixNametoDescMeta.execute = function(){

  var sels = app.document.selections;

  for (var i = 0; i < sels.length; i++){

var md = sels.synchronousMetadata;

    md.namespace = "http://ns.adobe.com/photoshop/1.0/";

    var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');

    md.Caption = Name + " " + md.Caption;

  }

}

if (BridgeTalk.appName == "bridge"){

var menu = MenuElement.create( "command", "Prefix Filename to Description Metadata", "at the end of Tools");

  menu.onSelect = prefixNametoDescMeta.execute;

}

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 ,
Aug 02, 2018 Aug 02, 2018

Copy link to clipboard

Copied

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