Copy link to clipboard
Copied
In the fileinfo panel, I would like to copy what's in the keywords and append it to the description. Any ideas? Thanks. I'm using Photoshop CC 2014.
As the others have shown this can be done with the file open in Photoshop, and can be done in one line of code.
activeDocument.info.caption = activeDocument.info.caption + ";" + activeDocument.info.keywords.toString();
But if you need to do a batch of files without opening them it would be better using a Bridge script.
Copy link to clipboard
Copied
Does this javascript statement help any
alert(app.activeDocument.info.keywords);
alert(app.activeDocument.info.instructions);
app.activeDocument.info.instructions = app.activeDocument.info.instructions + " " + app.activeDocument.info.keywords;
alert(app.activeDocument.info.instructions);
alert(app.activeDocument.info.description); // most have some other name .description is undefined
Copy link to clipboard
Copied
Thanks for your reply. I'll give it a whirl Monday morning.
Copy link to clipboard
Copied
Looking at the ExtendScript Object Model Viewer it looks like there is no Documentinfo description property or method. I can set the description files in Photoshop File Info XMP panel and I can retrive it in a Photoshop script by parsing the document xmpmetadata. However document xmpmetadata is read only in Photoshop scripting. However I do not know scripting well I just hack at it. You may be able to do it from the bridge or Photoshop by creating a metadata template. I seen some documentation on that subject
Photoshop Help | Metadata and notes
Copy link to clipboard
Copied
It turns out the Description is info caption so the script is easy. I have never written a Bridge script but it all you want to do is batch update metadata the bridge is what you should use. The main reason I use bridge is for metadata editing to update metadata and select groups of raw files the their thumbnails look to have similar exposures to develop ACR setting and sync setting using ACR. Files are not opened into Photoshop this way and processing is faster. I normally only use Windows File explorer and Photoshop when I edit images. Bridge can slow down processing if it needs to populate its cache....
Copy link to clipboard
Copied
Today I wrote a similar script: with "layer names" instead of "keywords". It was easy to adjust it to use keywords.
It was written and tested in CS6 for Windows; hope it would work in newer versions as well.
var cTID = function(s) { return app.charIDToTypeID(s); };
var sTID = function(s) { return app.stringIDToTypeID(s); };
main();
function main() {
if (app.documents.length > 0) {
var doc = app.activeDocument,
keywords = doc.info.keywords.join(", ");
if (keywords != "") {
writeToDescription(keywords);
}
else {
alert("No keywords were found.", "Write keywords to description", true);
}
}
else {
alert("Please open a document and try again.", "Write keywords to description", true);
}
}
function writeToDescription(str) {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Prpr'), cTID('FlIn'));
ref1.putEnumerated(cTID('Dcmn'), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putString(cTID('Cptn'), str);
desc1.putObject(cTID('T '), cTID('FlIn'), desc2);
executeAction(cTID('setd'), desc1, DialogModes.NO);
}
Copy link to clipboard
Copied
As the others have shown this can be done with the file open in Photoshop, and can be done in one line of code.
activeDocument.info.caption = activeDocument.info.caption + ";" + activeDocument.info.keywords.toString();
But if you need to do a batch of files without opening them it would be better using a Bridge script.
Copy link to clipboard
Copied
Thanks Philip for pointing this out. It is not immediately obvious (at least for me) that "description" hides under the term "caption".
Copy link to clipboard
Copied
Thank you. This worked great!
Copy link to clipboard
Copied
Can someone clarify the answer for a beginner? I would like a script to batch copy keywords to comments, description or any other more universal field in Bridge (not for photo files). Thank you