BEFORE close event

I’m able to add a Notification Listener to the document “close” event. But I’d like to get access to the “beforeClose” as is available in Adobe InDesign (via ExtendScript). Is that something that exists or is planned?

Here is what I’m using to call a function on the close event:

require('photoshop').action.addNotificationListener([ { event: "close" } ], psDocumentEvents_onClose);

where “psDocumentEvents_onClose” is a function that gets the event and some document details (alas, not enough details).

By the time “close” happens, the document is already closed. I’d like the opportunity to do things before it closes.

jsw

3 Likes

Agreed, would be helpful for some uses.

Would also be nice to have a similar onClose event when exiting PS itself to manage cleanup if needed.

2 Likes

Can’t find it now, so maybe I was only thinking it and never posted :smiley:

IMO all events MUST have a before{Event}. There may be lots of use cases. Maybe you want to save a snapshot before deleting a layer. Or maybe you want to do some stuff before creating new layer group, or before you move the layer.

3 Likes

Yes, we’d love to have some sort of beforeSave hook. For us, an opportunity to rasterize layers before each save would benefit for our production pipeline immensely. The save event’s saveStage.saveBegin seemed promising, but alas the notification is asychronous and too late.

Is there an avenue for submitting/upvoting feature requests?

I’ve been working with the UXP Developer Tools API for Adobe InDesign and have successfully added a notification listener to the document “close” event using the following code:

require('photoshop').action.addNotificationListener([{ event: "close" }], psDocumentEvents_onClose);

In this setup, psDocumentEvents_onClose is a function that receives the event and some document details. However, by the time the “close” event is triggered, the document has already closed, which limits the actions I can take.

In ExtendScript, there is a “beforeClose” event that allows us to perform actions just before the document closes. I’d like to know if a similar event exists or is planned for the UXP Developer Tools API in Adobe InDesign.

Having access to a “beforeClose” event would greatly enhance our ability to manage document states and perform necessary actions before the actual close operation completes.