Skip to main content
Participating Frequently
August 2, 2005
Question

Script to Export and Import Keywords and Metadata

  • August 2, 2005
  • 37 replies
  • 10452 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

Participant
November 26, 2005
Thanks Bob. Barredrock seems like just the ticket for my needs. That Scripting Guide is a little intimitating. ( I avoided having to learn dos by going Mac; avoided having to learn html with Dreamweaver; now will I have to confront scripting...?)
Known Participant
November 25, 2005
Chris,

Barredrock software (www.barredrocksoftware.com) has a script for sale that is a generalized metadata exporter. It will do what you need in a more general case.

I don't know what they charge for it, but I don't think anything on their site is more that $15.

The only definitive guide is the bridge scripting guide that is on your CD, and download-able from Adobe Exchange. You can also purchase a hardcopy from Adobe Press.

At the bottom of the forum message display you'll see "Show All Messages" on the right side of the same bar that contains the "First, Previous, Next, Last" options.

Bob
Adobe Workflow Scripting
Participant
November 24, 2005
If I may kindly piggyback on all the work Bob & Arnold have done: I too have been looking for a way to be able to provide clients with the medadata for images from their shoot, and the script that you have just made looks like IT. I have never worked with scripts, and it would help me if you could post three things for me (or is there an easier way to get it to me?)
1: the final, corrected script you have worked out, and
2: where to go for an informative guide about scripts that will tell me, from the begining, how to make one, install this one, and troubleshoot them.
3. How I can download all 14 of your postings in one file, so I can try to trace your prosess? (Seems like this is a good tool for the next Bridge revision.)
heathrowe
Inspiring
September 19, 2005
Super stuff Bob :)
heathrowe
Participating Frequently
August 8, 2005
Robert,

Thanks for your quick response. The script you modified works fine.

Can I impose on you to add to this script for the picture file size and flash elements (i.e. did strobe light fire, mode - auto, etc.)?

Thanks again,

Arnold
Known Participant
August 8, 2005
There were a couple of errors in the script.

Bob
Adobe WAS Scripting

Try this, save it to your startup scripts folder:

#target bridge

if (BridgeTalk.appName == "bridge" ) {

// Let's create our menu
var menu = MenuElement.create( "command", "Export CSV File", "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:", "Comma delimited file:*.CSV");

if ( !f ) { return; }

// Write the column headings
f.open("w");
f.writeln("Seq Number,New File Name,New File Name Path,Original File Name,Org Dt & Tm,ISO,Exposure Time,F Stop,EV,Exposure Program,Meter Mode,Focal Length,Flash,Lens,Author, Author's Position,City,Country,Description,Title,Orientation,Width,Height,Rating,Label,KeyWords");


// 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, "\",\"", item.path.replace(/\"/g, "\"\""), "\",\"", ListMetadata(item), "\",\"", "\"" );
}

f.close();
} catch(e) {
}
}
}

function ListMetadata(tn) {

md = tn.metadata;
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
var varAuthor = md.Author + "\",\"" + md.AuthorsPosition + "\",\"" + md.City + "\",\"" + md.Country + "\",\"";

var varKeywords = ListKeywords(md);

md.namespace = "http://ns.adobe.com/exif/1.0/aux/";
var varLens = md.Lens + "\",\"" ;

md.namespace = "http://purl.org/dc/elements/1.1/";
var vartitle = md.title + "\",\"" + md.description + "\",\"" ;

md.namespace = "http://ns.adobe.com/xap/1.0/mm/"
var VarPreservedFileName = md.PreservedFileName + "\",\"" ;

md.namespace = "http://ns.adobe.com/exif/1.0/"
var VarDateTimeOriginal = md.DateTimeOriginal + "\",\"" + md.ISOSpeedRatings + "\",\"" + md.ExposureTime + "\",\"" + md.FNumber + "\",\"" +
md.ExposureBiasValue + "\",\"" + md.ExposureProgram + "\",\"" + md.MeteringMode
+ "\",\"" + md.FocalLengthIn35mmFilm + "\",\"" + md.Flash + "\",\"" ;

md.namespace = "http://ns.adobe.com/tiff/1.0/"
var varOrientation = md.Orientation + "\",\"" + md.ImageWidth + "\",\"" +
md.ImageLength + "\",\"" ;

md.namespace = "http://ns.adobe.com/xap/1.0/"
var varRating = md.Rating + "\",\"" + md.Label + "\",\"";

return VarPreservedFileName + VarDateTimeOriginal + varLens + varAuthor + vartitle + varOrientation + varRating + varKeywords;

}

function ListKeywords(md) {
md.namespace = "http://ns.adobe.com/photoshop/1.0/";
var Keywords = md.Keywords;

var varKeywords = "" ;
for ( var i = 0; i < Keywords.length; ++i ) {
varKeywords = varKeywords + Keywords + ", ";
}
//strip off final comma and space varKeywords =
varKeywords.substring( 0, varKeywords.length-2);

return varKeywords ;
}
Participating Frequently
August 7, 2005
John,

I install the script you just provided me in the Adobe StartupScripts folder where I have been testing all my other updates. This recent script only gives me one record and stops on KeyWords field and has the word "undefined" in it. What am I doing wrong??

Arnold
john beardsworth
Community Expert
Community Expert
August 7, 2005
In ListMetadata, you dropped out the reference to ListKeywords. I just ran this and exported keywords as expected.

#target bridge

if (BridgeTalk.appName == "bridge")
{
// Let's create our menu
var menu = MenuElement.create( "command", "Export CSV File", "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:", "Comma delimited file:*.CSV");

// Write the column headings
f.open("w");
f.writeln("Seq Number,New File Name,New File Name Path,Original File Name,Org Dt & Tm,ISO,Exposure Time,F Stop,EV,Exposure Program,Meter Mode,Focal Length,Flash,Lens,Author, Author's Position,City,Country,Description,Title,Orientation,Width,Height,Rating,Label,KeyWords");

// 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, "\",\"", item.path.replace(/\"/g, "\"\""), "\",\"", 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/";
varAuthor = md.Author + "\",\"" + md.AuthorsPosition + "\",\"" + md.City + "\",\"" + md.Country + "\",\"";
varKeywords = ListKeywords(md);

md.namespace = "http://ns.adobe.com/exif/1.0/aux/";
varLens = md.Lens + "\",\"" ;

md.namespace = "http://purl.org/dc/elements/1.1/";
vartitle = md.title + "\",\"" + md.description + "\",\"" ;

md.namespace = "http://ns.adobe.com/xap/1.0/mm/"
VarPreservedFileName = md.PreservedFileName + "\",\"" ;

md.namespace = "http://ns.adobe.com/exif/1.0/"
VarDateTimeOriginal = md.DateTimeOriginal + "\",\"" + md.ISOSpeedRatings + "\",\"" + md.ExposureTime + "\",\"" + md.FNumber + "\",\"" + md.ExposureBiasValue + "\",\"" + md.ExposureProgram + "\",\"" + md.MeteringMode + "\",\"" + md.FocalLengthIn35mmFilm + "\",\"" + md.Flash + "\",\"" ;

md.namespace = "http://ns.adobe.com/tiff/1.0/"
varOrientation = md.Orientation + "\",\"" + md.ImageWidth + "\",\"" + md.ImageLength + "\",\"" ;

md.namespace = "http://ns.adobe.com/xap/1.0/"
varRating = md.Rating + "\",\"" + md.Label ;

return VarPreservedFileName + VarDateTimeOriginal + varLens + varAuthor + vartitle + varOrientation + varRating + varKeywords;

}

function ListKeywords(md)
{

var varKeywords = "" ;
for (var i = 0; i < md.Keywords.length; ++i) { varKeywords = varKeywords + md.Keywords + ", "; } //strip off final comma and space varKeywords = varKeywords.substring( 0, varKeywords.length-2);

md.namespace = "http://ns.adobe.com/photoshop/1.0/";
varKeywords = ListKeywords(md) + "\",\"" ;

return varKeywords ;
}
Participating Frequently
August 7, 2005
John,

I try to put it outside and it still didn't work. See below for my new script. I would reeally, really .... really appreciate if you could place the Keyword script in the correct location.

Thanks,

Arnold

=======================

#target bridge

if (BridgeTalk.appName == "bridge")
{
// Let's create our menu
var menu = MenuElement.create( "command", "Export CSV File", "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:", "Comma delimited file:*.CSV");

// Write the column headings
f.open("w");
f.writeln("Seq Number,New File Name,New File Name Path,Original File Name,Org Dt & Tm,ISO,Exposure Time,F Stop,EV,Exposure Program,Meter Mode,Focal Length,Flash,Lens,Author, Author's Position,City,Country,Description,Title,Orientation,Width,Height,Rating,Label,KeyWords");

// 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, "\",\"", item.path.replace(/\"/g, "\"\""), "\",\"", 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/";
varAuthor = md.Author + "\",\"" + md.AuthorsPosition + "\",\"" + md.City + "\",\"" + md.Country + "\",\"";

md.namespace = "http://ns.adobe.com/exif/1.0/aux/";
varLens = md.Lens + "\",\"" ;

md.namespace = "http://purl.org/dc/elements/1.1/";
vartitle = md.title + "\",\"" + md.description + "\",\"" ;

md.namespace = "http://ns.adobe.com/xap/1.0/mm/"
VarPreservedFileName = md.PreservedFileName + "\",\"" ;

md.namespace = "http://ns.adobe.com/exif/1.0/"
VarDateTimeOriginal = md.DateTimeOriginal + "\",\"" + md.ISOSpeedRatings + "\",\"" + md.ExposureTime + "\",\"" + md.FNumber + "\",\"" + md.ExposureBiasValue + "\",\"" + md.ExposureProgram + "\",\"" + md.MeteringMode + "\",\"" + md.FocalLengthIn35mmFilm + "\",\"" + md.Flash + "\",\"" ;

md.namespace = "http://ns.adobe.com/tiff/1.0/"
varOrientation = md.Orientation + "\",\"" + md.ImageWidth + "\",\"" + md.ImageLength + "\",\"" ;

md.namespace = "http://ns.adobe.com/xap/1.0/"
varRating = md.Rating + "\",\"" + md.Label ;

return VarPreservedFileName + VarDateTimeOriginal + varLens + varAuthor + vartitle + varOrientation + varRating;

}

function ListKeywords(md)
{

var varKeywords = "" ;
for (var i = 0; i < md.Keywords.length; ++i) { varKeywords = varKeywords + md.Keywords + ", "; } //strip off final comma and space varKeywords = varKeywords.substring( 0, varKeywords.length-2);

md.namespace = "http://ns.adobe.com/photoshop/1.0/";
varKeywords = ListKeywords(md) + "\",\"" ;

return varKeywords ;
}
john beardsworth
Community Expert
Community Expert
August 7, 2005
You see to have placed the keywords function inside the existing function. Not sure if this is right - I put it outside.