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

Is it possible to Change the Author of the image through Scripting?

New Here ,
May 30, 2010 May 30, 2010

I need to get the Author of the image through scripting. First i have to get the name of the Author which is already existing.And need to Rename the Author through script.  Its urgent requiremnt. pls help me out.

TOPICS
Scripting
554
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 ,
May 31, 2010 May 31, 2010
LATEST

This example will read and put the Authors name to the ESTK console and write the new details back to the document.


#target bridge
loadXMPLibrary();
var thumb = app.document.selections[0];
if(thumb.hasMetadata){
        var selectedFile = thumb.spec;
  var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
  var myXmp = myXmpFile.getXMP();   
  var arrItem='';
  var items = myXmp.countArrayItems(XMPConst.NS_DC, "creator");
   for(var i = 1;i <= items;i++){
arrItem += myXmp.getArrayItem(XMPConst.NS_DC,  "creator", i);          
        }   
    $.writeln(arrItem);
}
var Author = "This is my new Author";
myXmp.deleteProperty(XMPConst.NS_DC, "creator");
myXmp.appendArrayItem(XMPConst.NS_DC, "creator", Author, 0,XMPConst.ARRAY_IS_ORDERED);
if (myXmpFile.canPutXMP(myXmp)) {
    myXmpFile.putXMP(myXmp);
         myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
         }
unloadXMPLibrary();

function loadXMPLib(){
if (ExternalObject.AdobeXMPScript == undefined) {
    ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
}
}
function unloadXMPLib(){
   if( ExternalObject.AdobeXMPScript ) {
      try{
         ExternalObject.AdobeXMPScript.unload();
         ExternalObject.AdobeXMPScript = undefined;
      }catch (e){ }
   }
}

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