• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Copying filename to IPTC description - camera raw formats

New Here ,
Feb 23, 2016 Feb 23, 2016

Copy link to clipboard

Copied

This question has been asked previously in Bridge forums but not fully answered for CC and raw files.

I'd like to run a script from Bridge CC that will append the filename (minus extension) into the Description field of the IPTC metadata. It needs to work with multiple camera raw files (e.g. .ARW, .CR2). Previous suggestions worked with TIFs and DNGs but not proprietary camera raw formats.

Since characters '/' and ':' aren't permitted or recommended, it would be useful if these could be added by converting '*' and '=' from the filename.

For example,

Filename 1234.ARW should append as 1234

Filename 12*34.ARW should append as 12/34

Filename 12=34.ARW should append as 12:34

The description field may already contain some text, hence the need to append to this rather than replace.

If anybody could help with this, I'd be very grateful.

TOPICS
Scripting

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Feb 23, 2016 Feb 23, 2016

Ok, please try this.

#target bridge;

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

f2Desc = new MenuElement("command", "Filename to Description", "at the end of Tools");

}

f2Desc.onSelect = function () {

var sels = app.document.selections;

for(var a in sels){

var thumb = sels;

var Name = decodeURI(thumb.spec.name).replace(/\.[^\.]+$/, '');

Name =Name.replace(/\=/g,':').replace(/&/g,'/');

md = thumb.synchronousMetadata;

md.namespace =  "http://purl.org/dc/elements/1.1/";

var Caption = md.description

...

Votes

Translate

Translate
Guide ,
Feb 23, 2016 Feb 23, 2016

Copy link to clipboard

Copied

This script should be easy to write, BUT an asterisk it not allowed in a files name.

Is there an alternative you could use as a replacement?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 23, 2016 Feb 23, 2016

Copy link to clipboard

Copied

Thanks - I thought an asterisk was allowed! Anyway, I could use anything else allowed - how about '&'?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 23, 2016 Feb 23, 2016

Copy link to clipboard

Copied

Ok, please try this.

#target bridge;

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

f2Desc = new MenuElement("command", "Filename to Description", "at the end of Tools");

}

f2Desc.onSelect = function () {

var sels = app.document.selections;

for(var a in sels){

var thumb = sels;

var Name = decodeURI(thumb.spec.name).replace(/\.[^\.]+$/, '');

Name =Name.replace(/\=/g,':').replace(/&/g,'/');

md = thumb.synchronousMetadata;

md.namespace =  "http://purl.org/dc/elements/1.1/";

var Caption = md.description ? md.description[0] : "";

md.description='';

if(Caption != undefined){

    md.description = Caption + " " + Name;

    }else{

md.description = Name;

}

}

app.document.chooseMenuItem('PurgeCache');

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2016 Feb 24, 2016

Copy link to clipboard

Copied

Thanks! It works well. Only problem is that after running the script, the new metadata only shows up if I quit and restart Bridge. I can live with this though! Very useful anyway. Many thanks for your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 24, 2016 Feb 24, 2016

Copy link to clipboard

Copied

You can select the files, right mouse click then purge cache for selection. This will then update the files without restarting Bridge.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 24, 2016 Feb 24, 2016

Copy link to clipboard

Copied

That works perfectly now, thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2016 Aug 09, 2016

Copy link to clipboard

Copied

Hi, I've been trying to modify this script to add the filename into the 'keywords' field instead. Replacing 'description' with 'keywords' or 'subject' doesn't seem to work - any suggestions please?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 09, 2016 Aug 09, 2016

Copy link to clipboard

Copied

Have a look at this. Copy Filename to IPTC Keywords

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2016 Aug 09, 2016

Copy link to clipboard

Copied

That's great, many thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2016 Aug 09, 2016

Copy link to clipboard

Copied

I have not tested, however it is my understanding that Adobe do not allow editing of the raw file, even if it is just adding metadata (DNG being the exception). The metadata would be applied to the ACR database or XMP sidecar files. The venerable ExifTool will directly write metadata into a proprietary raw file (rewriting the entire raw file).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 09, 2016 Aug 09, 2016

Copy link to clipboard

Copied

That's true, but writing to a normal or a raw can use the same code if written in a certain way.

Here is an example of code to be run from ExtendScript Toolkit with a file selected in Bridge.

#target bridge;

item = app.document.selections[0];

md =item.synchronousMetadata;

md.namespace = "http://purl.org/dc/elements/1.1/";

md.title = "My Title";

md.namespace = "http://ns.adobe.com/photoshop/1.0/";

md.Author = ''; //remove data

md.Author = "My name goes here"; //add new data

This should work on all file types that support metadata.

With a raw file the xmp file will be auto generated if it didn't exist.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2016 Aug 09, 2016

Copy link to clipboard

Copied

LATEST

Just wanted the OP to know the difference, not knowing the expectation or how literal the topic title was intended to be.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines