How to monitor for "open" event for raw files exported from Lightroom?

I am trying to capture the “open” event when a raw file is exported to Photoshop from Lightroom for editing.

I am using the following code:

//Watch for batchPlay objects "open" and "layersFilterd"

require("photoshop").action.addNotificationListener([ 'open', 'layersFiltered' ], handleEvent);

function handleEvent (event, descriptor) {
    console.log(event)
};

The code works when opening a .psd file directly into Photoshop or when opening a raw file into Photoshop using Camera Raw. But the NotificationListener is NOT triggered when a raw file gets exported to Photoshop from Lightroom. The image, of course, opens in Photoshop and the History panel says “Open,” but the event does not trigger the NotificationListener.

Alchemist only shows a “hostFocusChanged” event happening for this event, but even adding this to the array of events to monitor for is not successful.

Is there another event I should be looking for? Is this a bug? Or is this just the way it works, in which case is there another method to monitor for the “open” event for images that come into Ps from Lr?

I’m testing on Mac at the moment. Haven’t tried this yet on Windows.

Addendum: Looks like this is a problem with just Lightroom and NOT Lightroom Classic. The addNotificationListener() function is working for raw images exported from Lr Classic. Not sure why that would be the case, and it would still be useful to be able to monitor for images opening from the web version of Lightroom.

1 Like

Try adding a listener for all (works only in dev mode) and see if there’s maybe some different event. If not, then most likely not possible to catch that

Thanks, @Karmalakas . ‘hostFocusChanged’ is the only event that registers when monitoring for ‘all’ events and ‘hostFocusChanged’ is not captured by

require("photoshop").action.addNotificationListener([ 'hostFocusChanged' ], handleEvent);

So, there appears to be no way to monitor for opening raw files from the web version of Lightroom.

1 Like