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

edit the description metadata field.

Guest
Sep 22, 2009 Sep 22, 2009

Is it possible to edit the 'description' field through a script.  I've been trying off and on all day and coming up dry. here is what i have now thanks to some script i've found from John Beardsworth (thanks, btw!!) that i managed to narrow to my needs...

#target bridge
if ( app.name == "bridge"  && app.version[0] == '3' )
{


// Create main menu item
   
    var menu = new MenuElement( "menu", "Filename to Metadata cart", "at the end of Tools", "g2mMenu");
    var g2tCommand =  new MenuElement("command", "click here", "at the end of g2mMenu");
//-----------------------------------------------------------------------
//Submenu for filename to iptc title
    g2tCommand.onSelect = function(m)
        {
        var getFolderChildren = true ;
        var filesOnly = true ;
        var thumbs = app.document.selections;
        for ( var i = 0; i < thumbs.length; i++ )
        { var thumb = thumbs;
           var md = thumb.synchronousMetadata;
           md.namespace ="http://purl.org/dc/elements/1.1//";
           md.Description= "hello World";
        }
           Window.alert ("Done " + i + " records");
        };

//closing brace
}

I simply cannot get it to change the info in the description field.  It even willl give me the alert saying it did  it and nothing will be there.  this works fine for Title and Headline, but not description... any ideas?

obivously this is a simpler version of what i actually want to write into the description field, otherwise i wouldn't need a script.  But if i can get this to work, i can get my real needs to work as well.

thansk.

TOPICS
Scripting
1.0K
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
Adobe Employee ,
Sep 25, 2009 Sep 25, 2009
LATEST

I think your main problem is that you are using the wrong property name. Try "description" and not "Description." XMP property names are case sensative.

The following script works for me:

#target bridge


// Where is this script?

var curFolder = new File( $.fileName ).parent;


// Make a simple JPEG file here for the test

var somePixels = new BitmapData( 300, 200);

var jpgFile = new File( curFolder.fsName + "/test.jpg");

somePixels.exportTo( jpgFile, 100, true );


// Make a thumbnail

var thumb = new Thumbnail( jpgFile );


// Get the Metadata

var md = thumb.synchronousMetadata;


// set the namespace

app.synchronousMode = true;

md.namespace = "http://purl.org/dc/elements/1.1/";

// set the property

md.description = "Testing 1,2,3";


// Make sure the Bridge UI sees the change

thumb.core.metadata.cacheData.status = "bad";

If I change my script to use "Description" then the script sets a new, bogus property "dc:Description" in the XMP.
I recommend always keeping a copy of Part 2 of the XMP Specification handy when writing any scripts that modify metadata. Double check the spec for the correct namespace URIs and property names. Get the spec here: http://www.adobe.com/devnet/xmp/
-David

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