Copy keywords into title field, keep in keywords field
I have this script that works in cs5, but it is not working in CS6- I am going to try to modify it to copy the keywords into the title field, but also drop the ";" and replace with a ","
First, I can't get CS6 to run this code, though. Where is it wrong? Thank you for any suggestions-
#target bridge
if( BridgeTalk.appName == "bridge" ) {
keysToDesc = MenuElement.create("command", "Keywords To Description", "at the end of Tools");
}
keysToDesc.onSelect = function () {
keysToDesc();
}
function keysToDesc(){
function getArrayItems(ns, prop){
var arrItem=[];
var items = myXmp.countArrayItems(ns, prop);
for(var i = 1;i <= items;i++){
arrItem.push(myXmp.getArrayItem(ns, prop, i));
}
return arrItem.toString();
}
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var thumb = app.document.selections;
for(var s in thumb){
if(thumb.hasMetadata){
var selectedFile = thumb.spec;
var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var myXmp = myXmpFile.getXMP();
var Keywords = getArrayItems(XMPConst.NS_DC,'subject').replace(/,/g,';')
myXmp.deleteProperty(XMPConst.NS_DC, "description");
myXmp.setLocalizedText( XMPConst.NS_DC, "description", null, "x-default", Keywords );
}
if (myXmpFile.canPutXMP(myXmp)) {
myXmpFile.putXMP(myXmp);
myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
} else {
xmpFile.closeFile();
}
}
}
