Photoshop: Notifier event for Open 'Opn ' documents fails when opens from CameraRaw. Why?

  • 1
  • Question
  • Updated 4 years ago
I have a script that enables the notifiers event to detect when photoshop opens a document:
app.notifiers.add("Opn ", myscript);
I works well but only when I open directly Image > Photoshop

But 95% of my work must get the images passing first on CameraRaw plugin.
Image > CameraRaw > Photoshop
The same notifier doesn't work at all and it is so important to run a script verification on every single opened image.

What is the logic of this? It is so frustrating.
Photo of Pedro Marques

Pedro Marques

  • 157 Posts
  • 25 Reply Likes
  • frustrated

Posted 4 years ago

  • 1
Photo of Trevor Morris

Trevor Morris

  • 20 Posts
  • 7 Reply Likes
Here's the ScriptListener for Open Camera Raw:

var desc1 = new ActionDescriptor();
desc1.putPath(cTID('null'), new File('path to file'));
var desc2 = new ActionDescriptor();
desc2.putString(cTID('CMod'), 'Camera Model');
desc2.putEnumerated(cTID('Sett'), cTID('Sett'), cTID('Img '));
desc2.putEnumerated(cTID('ClrS'), cTID('ClrS'), cTID('ProP'));
desc2.putEnumerated(cTID('BtDp'), cTID('BtDp'), cTID('BD16'));
desc2.putEnumerated(cTID('RStF'), cTID('RStF'), cTID('RFNo'));
desc2.putDouble(cTID('Rslt'), 300);
desc2.putEnumerated(cTID('ReUn'), cTID('ReUn'), cTID('PpIn'));
desc2.putEnumerated(cTID('OSM '), cTID('OSM '), cTID('OSMN'));
desc1.putObject(cTID('As '), sTID('Adobe Camera Raw'), desc2);
executeAction(cTID('Opn '), desc1, DialogModes.NO);

It does indeed fire the "Opn " notifier, however, I've noticed that the notifier isn't fired if the open command is initiated by a script. For example, if you set up a Script Event for "Open" via the Script Event Manager, the Script Event is executed when a Camera Raw file is open. However, if you open the same Camera Raw file via another script, the Script Event is not executed. Not sure what's going on here, and I'm not sure if any of the above is helpful or not.

--
Cheers,
Trevor
Photo of Pedro Marques

Pedro Marques

  • 157 Posts
  • 25 Reply Likes
Sorry Trevor, it has to be on CS6.

The starting point is on Bridge.
My team uses a button on a panel inside Bridge selecting only all present raws (it allows to respect the manual order on ACR)
Then when I clic open on ACRaw plugin, photoshop does not fire the 'Opn ' notifier at all.

This problem has same years though and it does not make sense.
I really like to know why and if it is possible to get a precious workarround to this.

Important: It have to be on CS6

This is the .onClick code that opens my raws on Bridge (the starting point)
var dd=app.document;
dd.deselectAll();
var f =dd.getSelection("DNG,dng,CR2,cr2");
for (var a in f) {
dd.select(f[a]);
}
dd.chooseMenuItem('OpenInCameraRaw');
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 13968 Posts
  • 1664 Reply Likes
How are you opening the files through camera raw? It looks like if you open through Photoshop you get the event, but if the files are opened through Bridge, the event isn't fired (and is similar to what Trevor sees above, as Bridge uses BridgeTalk scripting to open files in Photoshop)
Photo of Pedro Marques

Pedro Marques

  • 157 Posts
  • 25 Reply Likes
I must open them through ACRaw plugin, and if I do that manually starting on Bridge it does fire the notifier.

The problem is that for some reason not logical, it does not fire if the action of opening raws on bridge is made by script.

And that is a must for my team.

On bridge I have scripts to reorder thumbnails according to camera, to focal length, to other XMP properties and only after that it opens raws on ACR.
This must be done very quickly and we have succeeded very well on my ten with this.

But I also need to perform some image warnings by activating a script for all opened images. And here it fails.

My company is like a factory.
Huge quality, fast, and accurate.
Photo of Davide Barranca

Davide Barranca

  • 21 Posts
  • 3 Reply Likes
Hi,
to my tests too the Open event isn't fired when you open via script:

var myScript = File("~/Desktop/test.jsx"); 

// it does: alert("Fired!");
var myFile = File("~/Desktop/alce.jpg");

app.notifiersEnabled = true;
app.notifiers.add ("Opn ", myScript);

app.open(myFile); // alert isn't fired


Conversely, when the notifier is added and you open an image from Photoshop yourself, everything works as expected.
Even if the image is a Raw file (I've tested a .CR2 on Photoshop CC).
And, despite what Jeffrey said, even if I open it from Bridge...

The code was just:

var myScript = File("~/Desktop/test.jsx"); // alert("Fired!");


app.notifiersEnabled = true;
app.notifiers.add ("Opn ", myScript);


Hope this helps!

Davide Barranca
www.davidebarranca.com
Photo of Pedro Marques

Pedro Marques

  • 157 Posts
  • 25 Reply Likes
Tanks David.

I wish it could be so simple.

The starting point is on Bridge.
My team uses a button on a panel inside Bridge selecting only all present raws (it allows to respect the manual order on ACR)
Then when I clic open on ACRaw plugin, photoshop does not fire the 'Opn ' notifier at all.

This problem has same years though and it does not make sense.
I really like to know why and if it is possible to get a precious workarround to this.

Important: It have to be on CS6

This is the .onClick code that opens my raws on Bridge (the starting point):

var dd=app.document;
dd.deselectAll();
var f =dd.getSelection("DNG,dng,CR2,cr2");
for (var a in f) {
dd.select(f[a]);
}
dd.chooseMenuItem('OpenInCameraRaw');
Photo of Davide Barranca

Davide Barranca

  • 21 Posts
  • 3 Reply Likes
Hi Pedro,
just wondering: why don't you dispatch yourself an Open event after the OpenInCameraRaw?

Davide
Photo of Pedro Marques

Pedro Marques

  • 157 Posts
  • 25 Reply Likes
I thought that too, but there is a problem that made me loose so many hours trying to solve it.

Bridge will perform the half script well until
dd.chooseMenuItem('OpenInCameraRaw');

after this line it jumps to ACRaw and the fact is that we use some time (1 minute ) to make ACRaw adjustments.
Then we press Open button on ACRaw and in that moment, the second part of the Bridge script was ended for too long.

This means that I only can trigger 'Opn ' event when photoshop really has opened the images.

If I do that with BridgeTalk from bridge to photoshop just before the moment:
dd.chooseMenuItem('OpenInCameraRaw');
in fact the photoshop script of the 'Opn ' event would fail, because in fact the images still on ACRaw.

See the problem?
The event 'Opn ' should in fact run also with this situation (generated by bridge button script.)

2 years my team can not use 'Opn ' notifier = many errors avoided on our workflow.

But I am hoping that when I manage to redesign all script to CC (it will take time) this will work. The problem on this is that it will persist and we will no longer can have our bridge own panel with our buttons and notes.

For now CS6
Photo of Davide Barranca

Davide Barranca

  • 21 Posts
  • 3 Reply Likes
Pedro, do you think that a synchronous BridgeTalk would help?
This way you could dispatch the open event no matter how long it takes for the user to tweak the raw - possibly...

In case, have a look here:
http://selfdocumentingcode.blogspot.i...
Photo of Pedro Marques

Pedro Marques

  • 157 Posts
  • 25 Reply Likes
Yes, I think that will do if I only open a only one folder of raws > ACR > photoshop

But again...

My team productivity would be reduced largely at the ends of the day.

To run faster, a team element opens on bridge 5, 6, 7 products on different folders (each product has 5,6,7 raws).
If the script you suggest was running on the first product, it would have to wait until photoshop has opened all the images (it takes some time to have all raws opened).

We use that time to go back to bridge and open the second product and so on.
We would not be able to that anymore because bridge would be frizzed by th previous script.

This is the reality of a factory that produces images like us. Wish Adobe would be here to see. May be one day...

But I never give up.

I really appreciate your interest on this David! Thanks.