I don’t think it can be done, well not in Photoshop CS4 maybe with CS4 as that has access to the metadata. If you need to have it working for both CS3 and CS4 you would need to have Bridge open so that the keyword list could be fetched.
You can add keywords using templates but append only works in CS4 but then it does not work via an action.
Options use a script just for CS4 or have bridge running and use script that should work on both. Anyway I’m sure someone will come up with a solution.
Here is a script that I’ve just tested on CS3 that will append a keyword. Change MyNewKey var to suit.
#target photoshop
//////////////////////////////////////////////////////////// //////////////////////////
MyNewKey= "EnterYourNewKeywordHere";
//////////////////////////////////////////////////////////// /////////////////////////
BridgeTalk.prototype.sendSynch = function(timeout) {
var self = this;
self.onResult = function(res) {
this.result = res.body;
this.complete = true;
}
self.complete = false;
self.send();
if (timeout) {
for (var i = 0; i < timeout; i++) {
BridgeTalk.pump();
if (!self.complete) {
$.sleep(1000);
} else {
break;
}
}
}
var res = self.result;
self.result = self.complete = self.onResult = undefined;
return res;
};
function getKeys() {
var bridgeApp = "bridge";
if (!BridgeTalk.isRunning(bridgeApp)) {
BridgeTalk.launch(bridgeApp);
}
var bt = new BridgeTalk();
bt.target = bridgeApp;
bt.body = "function z(){var f = new Thumbnail(‘"+activeDocument.fullName.fsName+"’); var md = f.synchronousMetadata;"+
"md.namespace = ‘
http://ns.adobe.com/photoshop/1.0/‘; var result = md.Keywords;return result;}z();";
var res = bt.sendSynch(10);
addKeyWord(res,MyNewKey)
};
function addKeyWord(Keys,newKey) {
var desc19 = new ActionDescriptor();
var ref8 = new ActionReference();
ref8.putProperty( charIDToTypeID(‘Prpr’), charIDToTypeID(‘FlIn’) );
ref8.putEnumerated( charIDToTypeID(‘Dcmn’), charIDToTypeID(‘Ordn’), charIDToTypeID(‘Trgt’) );
desc19.putReference( charIDToTypeID(‘null’), ref8 );
var desc20 = new ActionDescriptor();
var list3 = new ActionList();
Keys=Keys.split(‘,’);
for(var a=0;a<Keys.length;a++){
list3.putString( Keys[a].toString() );
}
list3.putString( newKey);
desc20.putList( charIDToTypeID(‘Kywd’), list3 );
desc19.putObject( charIDToTypeID(‘T ‘), charIDToTypeID(‘FlIn’), desc20 );
executeAction( charIDToTypeID(‘setd’), desc19, DialogModes.NO );
};
getKeys();