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

description in metadata in cs5

Community Beginner ,
Oct 13, 2011 Oct 13, 2011

Hi,

Here is a script that output the keywords in the keywords metadata but dont do the same for the description part. (prompt)

addNametoMeta.execute = function(){

var shiftRange = prompt("test", 10);

var descript = prompt("Description", 10);

  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 + ";" + shiftRange  + ";" +  Name;

md.description[0]  = md.description[0]  + shiftRange +  descript;

  }

}

TOPICS
Scripting
889
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
Valorous Hero ,
Oct 13, 2011 Oct 13, 2011

With the description field it needs to be empty before you can put data into it.

md.description[0] = md.description[0] + shiftRange + descript; // This won't work as data exists

You could try doing the following...

var desc = md.description[0];

md.description[0] = '';

md.description[0] = desc + shiftRange + descript;

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 Beginner ,
Oct 20, 2011 Oct 20, 2011

Sorry.  It does not work.

#target bridge
addNametoMeta = {};

addNametoMeta.execute = function(){
var shiftRange = prompt("test", 10);
var descript = prompt("Description", 10);
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 + ";" + shiftRange  + ";" +  Name;
  var desc = md.description[0];
  md.description[0] = '';
  md.description[0] = desc + shiftRange + descript;
}
}

Thanks,

JP

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
Valorous Hero ,
Oct 20, 2011 Oct 20, 2011
LATEST

In that case you would have to use different code, you should be able to modify the code to suit from here...

http://forums.adobe.com/thread/887960?tstart=0

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