
Copy link to clipboard
Copied
Does anyone have a script that can be used in cs5 to copy the keywords to the description field?
Thanks
Mark
1 Correct answer
@Lumigraphics is correct, there is no way in Bridge (in the app or via scripting) to change file Date Created.
ExifTool is your best bet to do the batch edit you want.
ExifTool is an amazing tool but it is command line, which can be cumbersome if you're not used to it.
For what you want to do, I think this would be the command:
exiftool "-filecreatedate<datetimeoriginal" "DIR"
...where DIR is the name of a directory/folder containing the images.
I tested this and it works for me, meaning
...Copy link to clipboard
Copied
This should do it...
#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();
}
}
}

Copy link to clipboard
Copied
Thanks.
Um. now what?
I copied the text to a txt file, and saved it in the scripts folder. do I rename it with a jsx extension?
I'm using a mac.
(btw, I'm a bit of a newbie to the mac bit.
I can write macros in visual basic for windows no problem) Thanks.
Copy link to clipboard
Copied
Hi Mark,
Copy and paste the script into ExtendScript Toolkit
This gets installed with Photoshop and can be found:-
<hard drive>/Applications/Utilities/Adobe Utilities
Start Bridge
Adobe Bridge menu - Preferences - Startup Scripts
At the bottom click the "Reveal Button" this will open the folder where the script should be saved.
Close and restart Bridge.
Accept the new script.
To use:
Select the documents you want to do the changes to, then Tools - Keywords To Description
This will then copy all the keyword to the description field.
Hope this helps.
Copy link to clipboard
Copied
This might solve my issue, but there is no "<hard drive>/Applications/Utilities/Adobe Utilities" and i can't find any instance of ExtendScript on my hard drive. are these instructions for Mac OS? I have Win10.
Copy link to clipboard
Copied
jaebaeli you don’t really need ExtendScript Toolkit, any text editor such as Notepad.exe will do. Just make sure that your script is saved with a .jsx filename extension rather than .txt
Yes, that path was for the Mac, the forward slashes in the filepath and the word Applications are a dead giveaway for those that know that OS. For Windows, try:
C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe
Of course, simply having a valid Bridge .js or jsx file is not enough – you will also need to know where to install the script.
Open Bridge and to into Preferences (CMD/CTRL K) – then look for the Startup Scripts category. Next, press the “Reveal My Startup Scripts” button. This will open the correct folder/directory window for you to move the .jsx file into. Then quit Bridge and then re-launch Bridge again and you should be asked to enable the new startup script. If you do not see this message, ensure that there is a tick/checkmark against the script in your preferences.
Good luck!
Copy link to clipboard
Copied
(tried to edit my first post, but the Actions menu wouldn't generate the edit option) Here's the thread i started about my issue with the tags, FYI Re: Include tags in other metadata areas?
Copy link to clipboard
Copied
Indeed, I am happy to help if you can reply to my questions and or supply a sample file containing the required metadata.
I am not sure if what you wish to do can be accomplished with Bridge scripting, however until the source and destination fields are known I can’t say. That being said, I can also help with ExifTool as a fallback option if this can’t be achieved using scripts in Bridge.
Copy link to clipboard
Copied
Hi all,
I'm looking for the opposite approach! I have a client looking to turn thousands of photo descriptions into keywords. I've looked through the forums but couldn't find an answer to my problem. The script needs to turn the description field in my metadata to individual keywords. Each space in between the words would need to be turned into a comma so bridge can read each word in my description as as separate keyword. Does anyone have a script like this?
Copy link to clipboard
Copied
OK, I have a two step approach. I can’t script, but sometimes I can hack them, so I have not worked out how to combine the two scripts into one (which is probably easy if you know what you are doing).
Work on copied files until you are 100% sure that testing results in what you are looking for!
STEP 1: First, run this script on the selected images, it will copy the description metadata to the keywords as single string:
// https://forums.adobe.com/thread/1075021
// NOTE: THIS IS AN INCOMPLETE WORKFLOW HACK, A SECOND SEPARATE SCRIPT MUST BE RUN TO SEPARATE THE DESCRIPTION STRING TO SEPARATE KEYWORDS
#target bridge
if( BridgeTalk.appName == "bridge" ) {
descTosubject = MenuElement.create("command", "Add Description to Subject/Keywords", "at the end of Tools");
}
descTosubject.onSelect = function () {
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 Description = getArrayItems(XMPConst.NS_DC, "description");
myXmp.deleteProperty(XMPConst.NS_DC, "subject");
myXmp.appendArrayItem(XMPConst.NS_DC, "subject", Description, 0, XMPConst.ALIAS_TO_ALT_TEXT);
myXmp.setQualifier(XMPConst.NS_DC, "subject[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
}
function getArrayItems(ns, prop){
var arrItem=[];
try{
var items = myXmp.countArrayItems(ns, prop);
for(var i = 1;i <= items;i++){
arrItem.push(myXmp.getArrayItem(ns, prop, i));
}
return arrItem;
}catch(e){alert(e +" Line: "+ e.line);}
}
if (myXmpFile.canPutXMP(myXmp)) {
myXmpFile.putXMP(myXmp);
myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
} else {
xmpFile.closeFile();
}
}
}
STEP 2: The second stage will be to run this script on the selected images, that will break each word separated by a space into a separate keyword:
// https://forums.adobe.com/thread/2415320
// https://forums.adobe.com/message/10658929#10658929
#target bridge
if( BridgeTalk.appName == "bridge" ) {
sepkeys = MenuElement.create("command", "Seperate Keywords v2", "at the end of Tools");
}
sepkeys.onSelect = function () {
var thumbs = app.document.selections;
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var FolderName = decodeURI(Folder(app.document.presentationPath).name);
for(var a =0;a<thumbs.length;a++){
var selectedFile = new Thumbnail(thumbs);
app.synchronousMode = true;
var xmp = new XMPMeta(selectedFile.synchronousMetadata.serialize());
var keys = getArrayItems(XMPConst.NS_DC,"subject");
if(keys.length == 1){
xmp.deleteProperty(XMPConst.NS_DC,'subject');
keys = keys[0].toString().replace(/ /g,',').split(",");
for(var k in keys){
xmp.appendArrayItem(XMPConst.NS_DC, "subject", keys.toString(), 0,XMPConst.PROP_IS_ARRAY);
}
var newPacket = xmp.serialize(XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
selectedFile.metadata = new Metadata(newPacket);
}
}
ExternalObject.AdobeXMPScript.unload();
ExternalObject.AdobeXMPScript = undefined;
function getArrayItems(ns, prop){
var arrItem=[];
var items = xmp.countArrayItems(ns, prop);
for(var i = 1;i <= items;i++){
arrItem.push(xmp.getArrayItem(ns, prop, i));
}
return arrItem;
};
};
Prepression: Downloading and Installing Adobe Scripts
_____________________
The equivalent ExifTool command can be used to perform this in a single step writing dc:subject metadata:
exiftool -overwrite_original -sep " " -tagsfromfile @ '-subject+<${description}' -r 'pathTOfileORfolder'
Or perhaps writing both dc:subject and legacy itpc:keywords at the same time:
exiftool -overwrite_original -use MWG -sep " " -tagsfromfile @ '-keywords+<${description}' -r 'pathTOfileORfolder'
_____________________
Again work on copied files until you are 100% sure of the results!
Copy link to clipboard
Copied
It worked perfectly! Thank you so much!
Copy link to clipboard
Copied
My pleasure, glad to help!
Copy link to clipboard
Copied
This is amazing, but I'd like to copy keywords to the description field (the reverse) so that I can get google photos to recognize the terms.
But it is not as easy as just flipping the category codes in the first script. I tried and it doesn't work.
Can you help me figure out what I need to change?
Thanks
Copy link to clipboard
Copied
That is what Paul’s original script in reply #1 should do, copy keywords to description:
Re: Script for copying keywords to description field
P.S. The basic ExifTool command on Mac OS would be:
exiftool -overwrite_original '-description<$subject' -r 'pathTOfileORfolder'
Copy link to clipboard
Copied
I think at the end of the code:
xmpFile.closeFile();
is a typo error, and the correct is:
myXmpFile.closeFile();
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@X-T4Newbie Question about request 4
4. Copy USER SELECT POPUP keywords/image FROM Bridge XML? sidecar (or whereever they are stored?)
Do you want a popup (or dropdown list) that comes from keyword list that appears on the Bridge Keyword panel?
Copy link to clipboard
Copied
X-T4Newbie wrote:
Furthermore, the displayed JSX code in the 2011 article had MUCH code lined-out, looking incomplete, giving me pause to load it into my Adobe Bridge 2022 app and precious images.
If the script doesn't work with Bridge, there will be an error and then all you need to do is uninstall. When testing a script, always work on a copy of your precious images until you are happy with the results.
The forum software has gone through some changes, old posts don't always display as originally intended.
I have a copy in my archive from 2017 for a similar script:
// https://forums.adobe.com/thread/1223292
// https://forums.adobe.com/thread/2318450
#target bridge
if (BridgeTalk.appName === "bridge") {
keysToDescription = MenuElement.create("command", "Keywords To Description (v2017)", "at the end of Tools");
}
keysToDescription.onSelect = function () {
var sels = app.document.selections;
for (var a in sels) {
md = sels[a].synchronousMetadata;
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
var Keys = md.Keywords.toString().replace(/,/g, ', '); // Replace a comma with comma space
md.namespace = "http://purl.org/dc/elements/1.1/";
md.description = '';
md.description = Keys;
app.document.chooseMenuItem("PurgeCacheForSelected");
}
};
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
X-T4Newbie wrote:
Why? I've installed a Linux HDTV "Fotoxx" app that displays a so-called "Subject" field, which I'm thinking is related to the IPTC Core "Subject Code" field! Maybe?
You should populate all available metadata fields with descriptive text and test before anybody spends time on the assumption that this is the correct field.
Copy link to clipboard
Copied
Stephen is right, you need to first determine which metadata fields Fotoxx is using. I have a feeling it's not IPTC Subject Code because that is an 8-digit code from the IPTC Subject NewsCode Controlled Vocabulary (see: http://cv.iptc.org/newscodes/subjectcode).
Copy link to clipboard
Copied
" Stephen is right, you need to first determine which metadata fields Fotoxx is using. I have a feeling it's not IPTC Subject Code because that is an 8-digit code from the IPTC Subject NewsCode Controlled Vocabulary (see: http://cv.iptc.org/newscodes/subjectcode). "
============
Hi Guys, sorry for extreme delay (got Linux/Fotoxx reinstalled and working) responding to your advice about copying specific Metadata into Fotoxx's slideshow "Caption-Abstract" field. I've proven that if select Keyword(s) are copied into the metadata "Description" field, it is displayed during a slideshow as the Fotoxx "Caption-Abstract" field per image. So now, my question to you: Can the Adobe Bridge script you provided me provide a "popup list" of hierachical keywords from metadata's "HierarchicalSubject" list per each image? Then, for example, I might choose an Event or People or Place HierarchicalSubject, as there's limited room to display all Keywords info. Thank you for the help. (BTW: I get a first position, first line Adobe Bride 2022 error when trying to install the Script you guys already provided me. Any idea what JSX error I'm making as a newbie?) Thanks, Bob
Copy link to clipboard
Copied
This is a sample script for reading and replacing data in the description field:
XMPdesc();
XMPdesc = function(){
var descThumbs = app.document.selections; //get selected thumbnails
var newText = 'test'; //replacement text
if(!descThumbs.length) return; //nothing selected
for(var a in descThumbs){ //loop through thumbs
if(!descThumbs[a].container){ //not a folder
try{
var descMeta = descThumbs[a].synchronousMetadata; //get metadata
var descXMP = new XMPMeta(descMeta.serialize()); //serialize
alert(descMeta.read(XMPConst.NS_DC, 'description').toString()); //read description
descXMP.deleteProperty(XMPConst.NS_DC, 'description'); //delete
descXMP.setLocalizedText(XMPConst.NS_DC, 'description', null, 'x-default', newText); //set new description
var descUpdatedPacket = descXMP.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT); //serialize
descThumbs[a].metadata = new Metadata(descUpdatedPacket); //write to file
}
catch(e){
alert(e + e.line);
}
}
}
}
Copy link to clipboard
Copied
I have an idea for the UI, but I need more information on the requirements @X-T4Newbie
Copy link to clipboard
Copied
Thank you all for replies to this Adobe Bridge newbie, @X-T4Newbie.
I've not had chance to try the macros provided. But some simple feedback: As my Keywords are hieracial in Bridge on right side of page (like example Stephen provided at top of thread), it would be alot easier to select a FEW select keywords for Description/Subject, rather than listing them ALL during a slideshow to family members... if that is even possible to resresent by script!? Try hard to copy/install/execute JSX first provided soon given simple instructions how. (Ran into a RPi Linux problem today - which I'm a novice at too. Have to reinstall custom OS....) But Thank you. X-T4Newbie
Copy link to clipboard
Copied
P.S. Important along with select Keywords is to also pickup the Date Originally Created from EXIF. For example, if available, I'd concatenate <"YYYYMMDD"> (an EXIF field) <Los Angeles"> (a select keyword) <"Christmas"> (a select keyword).

