Skip to main content
Dandil30
Participant
April 17, 2009
Answered

a newbie question

  • April 17, 2009
  • 1 reply
  • 1093 views

Hello;

I'm just discovering the java scripting in abobe bridge and can't find interresting samples on the internet just to learn how to "speak" to bridge.

What i need to do is a script that for a selection set of thumbs iterates through it and writes some IPTC Data for me.

I found the way to write but i now need to get the shooting data of the photo in the exif datas and pass it to the IPTC data : Date Created.

The thing is that i don't find the trick to read the good EXIF info about the shooting date of the photo.

Any help, samples and internet websites are welcome.

Thanks for your help.

Daniel Diligent

This topic has been closed for replies.
Correct answer Kasyan Servetsky

Hi Daniel,

Here is a version of the script for CS4, put it into the start up folder and after restart Sync IPTC Date menu item will appear at the end of Tools menu.

Kasyan


#target "bridge"

var syncDateCommand = new MenuElement( "command", "Sync IPTC Date", "at the end of Tools", "myAlert" );

syncDateCommand.onSelect = function () {
    var sels = app.document.selections;

    for (i = 0; i < sels.length; i++){
        var md = sels.metadata;
        md.namespace = "http://ns.adobe.com/exif/1.0/";
        var dt = md.DateTimeDigitized;
        var shortdate = dt.substr(0, 4) + "-" + dt.substr(5, 2) + "-" + dt.substr(8, 2);
        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        md.DateCreated = shortdate;
    }
}

1 reply

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
April 18, 2009

Hi Daniel,

Here is a version of the script for CS4, put it into the start up folder and after restart Sync IPTC Date menu item will appear at the end of Tools menu.

Kasyan


#target "bridge"

var syncDateCommand = new MenuElement( "command", "Sync IPTC Date", "at the end of Tools", "myAlert" );

syncDateCommand.onSelect = function () {
    var sels = app.document.selections;

    for (i = 0; i < sels.length; i++){
        var md = sels.metadata;
        md.namespace = "http://ns.adobe.com/exif/1.0/";
        var dt = md.DateTimeDigitized;
        var shortdate = dt.substr(0, 4) + "-" + dt.substr(5, 2) + "-" + dt.substr(8, 2);
        md.namespace = "http://ns.adobe.com/photoshop/1.0/";
        md.DateCreated = shortdate;
    }
}

Dandil30
Dandil30Author
Participant
April 20, 2009

Thanks Kasyan, your answer helped me a lot.

I just had to add the correct lines from your script to mine and job's done.

The thing is to understand namespaces and wich one to use what for. Any documentation or links on this is welcome.

Thanks again.

Daniel Diligent