Skip to main content
Inspiring
December 17, 2012
Answered

Set a label based on a metadata field

  • December 17, 2012
  • 1 reply
  • 5235 views

Hi friends

Would like to know if this can be automatized via a JavaScript.

When I´m in a folder with lots of photos I use green label to choose the photos I want to print.

BUT if I feel I need to correct anything in a selected photo, then I use the blue label for this instead.

So I know if a photo has the green label then I can print directlly. But If a photo has the blue label then I know I need to make adjustments in Photoshop.

---

Now the question:

For blue label photos I use to write instructions directelly to the metadata field called "Instructions" (it´s in the IPTC Core section of metadata). And I´d like a script to automate it. Example:

If I write anything to the "Instructions" field...then automatically apply (or change to) the blue label!

Now If..after...I delete the message on that field...then check if the photo has keywords

         If having....apply the green label.

          If not having...apply NO LABEL.

---

IS it possible to automate it via script?

If yes..then I´ll try to write it

Thank you for the tips.

Gustavo.

This topic has been closed for replies.
Correct answer Paul Riggott

Hi Muppet

Almost. Your code was able to acess the Instructions metadata field but it does not worry if it has or no data...the script is putting that label.

I tried to simplify to script in order to understand myself...But I´m getting the same problem...I do not know what to write in the IF condition to verify if the instructions field has or no data.

See it:

#target bridge

app.synchronousMode = true

var documento = app.document.selections[0];

var xmp = documento.synchronousMetadata

var instrucao

instucao = xmp.read ('http://ns.adobe.com/photoshop/1.0/', 'Instructions')

if (instrucao != ???????) {

    documento.label = "Adjustments"

}

Thank you a lot

Gustavo


This may help...

#target bridge

app.synchronousMode = true;

var documento = app.document.selections[0];

var xmp = documento.synchronousMetadata;

var instrucao =  "'" + xmp.read ('http://ns.adobe.com/photoshop/1.0/', 'Instructions') + "'";

var Keys = xmp.read('http://purl.org/dc/elements/1.1/','dc:subject');

var BlueLabel = 'Review';

var GreenLabel = 'Approved'

if (instrucao == "''" && Keys.length > 0) {

    documento.label = GreenLabel;

}

if (instrucao == "''" && Keys.length == 0) {

    documento.label = '';

    }

if (instrucao != "''") {

   documento.label = BlueLabel;

}

1 reply

Inspiring
December 17, 2012

Scripting a label change based on metadata or writing matadata based on labels is scriptable… I don't see anything in bridge's events for thumbnails being modified… although if you modify the metadata the file time stamp gets bumped… so you may be able to watch for that

Inspiring
December 17, 2012

Thank you a lot Muppet.

Will try to write the script. I´ve downloaded the Bridge SDK that contains the Bridge script reference manual. Let´s see how it works

Thank you a lot

Best Regards

Gustavo.

Inspiring
December 17, 2012

It should also be possible to with document selectionsChanged but Im not sure if that would be annoying… kicking in all the time you would have to try it yourself…