Skip to main content
Inspiring
September 28, 2016
Answered

Save a copy to specific folder and edit original

  • September 28, 2016
  • 1 reply
  • 822 views

Is it possible in Bridge to make a script that:

  1. Copy a photo from original folder to a specific other folder
  2. Give the original photo a keyword, label or a metadata field with the date of today?

I've been using PHP and VBA, and have just started learning JavaScript, so I might manage to figure out something of my own if you point me in the right direction. If you could give me the script ready to use I'll be very grateful.

Our situation:

We are publishing photos in a weekly news paper and online. We have photos in one folder, ready to use. When we put a photo in production we copy it to another folder, but we would like to know if and when a photo has been used, so we're not using the same photo over and over again. It would be very nice If we can mark the original somehow with "used" and "date".

Thank you!

Using Bridge CC 6.3.1.186 x64

This topic has been closed for replies.
Correct answer SuperMerlin

Here is an example of adding "Used" and the date to the title field also copying the file to a selected folder.

#target bridge 

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

copyAndDate = MenuElement.create("command", "Copy and Date files", "at the end of Tools");

}

copyAndDate.onSelect = function () {

if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

var copyFolder = Folder.selectDialog("Please select folder to copy files to...",Folder(app.document.presentationPath));

var sels = app.document.selections;

for(var a in sels){

var thumb = sels;

thumb.copyTo(copyFolder);

var md = thumb.synchronousMetadata;

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

md.title = '';

md.title = "Used " +  new XMPDateTime(new Date());

    }

};

1 reply

SuperMerlin
SuperMerlinCorrect answer
Inspiring
September 29, 2016

Here is an example of adding "Used" and the date to the title field also copying the file to a selected folder.

#target bridge 

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

copyAndDate = MenuElement.create("command", "Copy and Date files", "at the end of Tools");

}

copyAndDate.onSelect = function () {

if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

var copyFolder = Folder.selectDialog("Please select folder to copy files to...",Folder(app.document.presentationPath));

var sels = app.document.selections;

for(var a in sels){

var thumb = sels;

thumb.copyTo(copyFolder);

var md = thumb.synchronousMetadata;

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

md.title = '';

md.title = "Used " +  new XMPDateTime(new Date());

    }

};

IngyNorwAuthor
Inspiring
October 2, 2016

Thank you, this was just what I needed, you made my day!

Just one question: If I just want the date and not time, how do I do that? Is it possible to show XMPDateTime as YYYY-MM-DD or DD-MM-YY?

SuperMerlin
Inspiring
October 2, 2016

Just change:-

md.title = "Used " +  new XMPDateTime(new Date()); 

To:

md.title = "Used " +  new XMPDateTime(new Date()).toString().match(/.{10}/);

This will just use the first 10 characters.