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

Adobe Bridge 2018 script to "Prepend filename to the Description"

New Here ,
Aug 01, 2018 Aug 01, 2018

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 ????

TOPICS
Scripting
1.1K
Translate
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

Community Expert , Aug 02, 2018 Aug 02, 2018

You mean correct choise for description aka caption? If so then with Dublin Core it doesn't work. Caption is undocumented. There's description indeed in reference but as I don't work with Br scripting often I can not remind now did I ever used that.

Ah, your right… now I’m really confused!

Let me dig a little deeper!

EDIT: OK, so the script in the OP is adding the filename to the end/suffix (without a word space or other separator) of the existing DC:Description metadata.

The following code will pre

...
Translate
LEGEND ,
Aug 02, 2018 Aug 02, 2018

Your code works. Description you used is incorrect. Caption included in original code is that keyword you are looking for

Translate
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

Hi Kukurykus

As you say stephend54917218 has a sample script that is targeting the Caption metadata (even though the script mentions description, that is obviously a mistake, perhaps inherited from altering another script that was originally targeting the description metadata).

If you wish to target the description metadata, then you need to use the correct namespace.

I don’t believe that the Photoshop NS http://ns.adobe.com/photoshop/1.0 is the correct choice for the description metadata. I believe that the script should be using the Dublin Core http://purl.org/dc/elements/1.1/ NS instead.

Translate
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

You mean correct choise for description aka caption? If so then with Dublin Core it doesn't work. Caption is undocumented. There is description indeed in reference but as I don't work with Br scripting often I can not remind now did I ever use that.

Translate
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

You mean correct choise for description aka caption? If so then with Dublin Core it doesn't work. Caption is undocumented. There's description indeed in reference but as I don't work with Br scripting often I can not remind now did I ever used that.

Ah, your right… now I’m really confused!

Let me dig a little deeper!

EDIT: OK, so the script in the OP is adding the filename to the end/suffix (without a word space or other separator) of the existing DC:Description metadata.

The following code will prefix/prepend the filename without extension before the DC:Description (Photoshop Caption) metadata, separated by a word space:

#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;

}

Translate
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

I noticed it as well, there was md.Caption before Name, quite the contrary to that he stated in his title, but I wasn't sure wasn't it his intetnion to insert file name in front of existing description or like 'prepend' stands for put it at end.

Translate
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 05, 2018 Aug 05, 2018

Thank you so much !!!

Translate
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 05, 2018 Aug 05, 2018

If you wanted to add Name at beginning of Description why you were adding it at end?

Translate
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 07, 2018 Aug 07, 2018

I was just trying to get ANYTHING to work so I wanted to alter the minimum amount of script as possible.

Thanks for your help.

Translate
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 08, 2018 Aug 08, 2018
LATEST

If anything that works then like I said your original code worked, didn't it?

Translate
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