Skip to main content
Participating Frequently
August 2, 2005
Question

Script to Export and Import Keywords and Metadata

  • August 2, 2005
  • 37 replies
  • 10450 views
I have a requirement to mass upload and download keywords and various metadata fields (i.e. File Name, Date Created, City, Country, Document, Title, etc.) into an external database from the Adobe Bridge. Ideally it would be compatible to .txt, .csv, etc type of database format. Currently I have to accomplish this task one at a time. I have an immediate need to upload 1000 plus pictures and various text fields into my website to share with others and be able to sell my pictures online.

My immediate is for exporting the metadata and keywords.

Does anyone know of a script that is aavailable?

Arnold
This topic has been closed for replies.

37 replies

Participating Frequently
November 30, 2008
Thanks for answer

Good Luck.
______
My Si tes
Participant
October 8, 2008
Paul R.,

Sorry I haven't been back to look at your response and help before today. This appears to be "right on" getting the information I need. I'm relatively new to scripting Bridge so I'll see if I can learn from your example and apply it to the script I have been using in CS2. Hopefully there won't be any script surprises in CS4.

Thanks again...
paulshoe
Paul Riggott
Inspiring
April 7, 2008
Sylvia:-
It may be possible to export to workbook, but it would have to be done with VB.
Your second question, it might be that the fourth file is NOT a valid photoshop file. It might be better to change the code to selections and see if that works.

Paul.
Paul Riggott
Inspiring
April 6, 2008
Paul, is this something like?

#target bridge
if (BridgeTalk.appName == "bridge" ) {
var menu = MenuElement.create( "command", "Export Info to Text File", "at the end of Tools");
menu.onSelect = function(m) {
try {
var f = File.saveDialog("Export file list to:", "Text file:*.TXT");
if ( !f ) { return; }
f.open("w");
f.writeln( "~Filename~,~Title~,~Author~,~Copyright~,~Address~,~City~,~State~,~Zip~,~Phone~,~Email~,~Website~" + "\n");
var items = app.document.selections;
for (var i = 0; i < items.length; ++i) {
var item = items;
f.writeln(item.name,',',ListMetadata(item) );
};
f.close();
} catch(e) {}
};
};

function ListMetadata(tn) {
md = tn.metadata;
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
var fileInfo = "~" + md.AuthorsPosition + "~,~" + md.Author + "~,~" + md.Copyright + "~,~";
md.namespace = "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/";
var myCity = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrCity");
var myRegion = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrRegion");
var myPostCode = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrPcode");
var myCountry = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrCtry");
var myTel = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiTelWork");
myTel = myTel.replace(/\n/g, ' ');
var myEmail = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiEmailWork");
var myURL = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiUrlWork");
var myAddress = md.read("http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/", "Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr");
myAddress = myAddress.replace(/\n/g, ' ');
fileInfo += myAddress + "~,~" + myCountry + "~,~" + myRegion + "~,~" + myPostCode + "~,~" + myTel + "~,~" + myEmail + "~,~" + myURL + "~";
return fileInfo;
};
Participant
April 5, 2008
Hi folks,

This is really Great work!!! Thanks so much.

2 questions:
1.Is is possible to export directly to an access database table?
2.I am using CS3 but can only get the info for 3 images to show up any idea why.

By the way for any newbies like me you have to copy the code you see in the posting into notepad or Adobe ExtenScript Toolkit2 and save the file as a .jsx file.

Then in Bridge select edit/preferences/startup scripts and click the button "Reveal" to see where you scripts folder is on your system. Then you just save your file to that folder. Shut down Bridge reopen it and you will be asked if you would like to install the script. Once it's installed you will see it listed at the bottom of the tools drop down.

Here is my code:

#target bridge

if (BridgeTalk.appName == "bridge")
{
// Let's create our menu
var menu = MenuElement.create( "command", "Export File List to Excel", "at the end of Tools");
menu.onSelect = function(m) {
try
{
// Let's ask what the name of the output file
var f = File.saveDialog("Export file list to:", "Microsoft Office Excel Workbook:*.XLS");

// Write the column headings
f.open("w");
f.writeln("#,Image_Name,Copyright,");

// Let's get a list of all the visible thumbnails
var items = app.document.visibleThumbnails;

for (var i = 0; i < items.length; ++i) { var item = items; f.writeln(i + 1, ",\"", item.name, "\",\"", ListMetadata(item), "\",\"", "\"" ); } f.close(); } catch(e) { } } menu.onDisplay = function(m) { m.enabled = app.document.contentPaneMode == "filesystem" && app.document.visibleThumbnails.length > 0;
}
}

function ListMetadata(tn)
{
md = tn.metadata;
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
varCopyright = md.Copyright + "\",\"" ;

return varCopyright;

}

Many Thanks
Sylvia
Participant
January 28, 2008
Not sure how active this forum is, but will try anyway. I am looking for a script to insert in an action to add Filename in Metadata through Bridge. I am a Photographer and work w/ LR V1.3.1.
The LR works fine, but when exporting images, the app will not tick the Copyright Status Switch or the Copyright information.

I have written actions to overcome this, but still have to add Document Name to each file.

Is there a better way?

Thanks,
Alex@bachnickphoto.com
October 29, 2007
I will have a look at it; however, at this time I am horribly buried in work. I'll get to it as quickly as I can.

Bob
Participating Frequently
October 28, 2007
i have been over seas for a while... I have come back & installed the script and its working!!!

just wanted to say Thanks!!!

I am in the middle of creating a Image Library for our company and we are developing it with Index Server and I need to supply lists of the keywords used & this script is great as it gives me a file with all the keywords in one document...

thanks again!
Participant
October 28, 2007
Bob,

Thanks for the response these seem to be a great utilities. However, the script that you directed me to does not allow me to retrieve data from the specific entries I need as listed above. i.e. "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" - address, city, state, zip, phone, email and website.

The script I have works fine in CS2. I would like to migrate completely to CS3, but I can't get this script to work. Hopefully someone knows a solution.

Paul
September 22, 2007
There is a pretty good export metadata script up on my website.

www.creativescripting.net

Look for the barred rock scripts. It's in that set.

Regards

Bob
www.creativescripting.net
for all your Bridge and InDesign scripting needs