My plugin is listening to the Photoshop ‘close’ action. The action is triggered twice once with the data element ‘_isCommand’ TRUE and then again with FALSE.
Because I want the action to be handled only once I listen to ‘_isCommand’ FALSE and ignore the other one. That worked fine.
With the new Photoshop version v. 22.4.3 the closing action is also called with ‘saving’ in the event data. And if the ‘saving._value’ is TRUE the ‘close’ action is called again when the document has been saved.
So my workaround for this new behavior was to ignore the action with ‘saving._value’ TRUE. But when the workspace setting is set to ‘Open Document as Tabs’ the fourth ‘close’ action is not called.
How do I know, if the closed document was a floating document window or even better:
How to listen to the ‘close’ action correctly?
I had same issue with 22.1 I think, but after I simply restarted Ps, I noticed it was triggering only one event instead of two. It wasn’t close event I was listening to, but still. I’m not sure what’s happening with double events, but here’s my related question just in case:
It mostly happens if ‘Save in background’ is also enabled.
then an additional close is fired after ’ backgroundSaveCompleted’
If Tabs are used and Background Save is activated I receive an additional save
event:
event: close; desriptor {"as":{"_obj":"photoshop35Format"},"in":{"_path":"/mypath","_kind":"local"},"documentID":339,"lowerCase":true,"saving":{"_enum":"yesNo","_value":"yes"},"forceNotify":true,"_isCommand":false}
event: save; desriptor {"in":{"_path":"/mypath/Sample.psd","_kind":"local"},"documentID":339,"saveStage":{"_enum":"saveStageType","_value":"saveSucceeded"},"_isCommand":false}
event: close; data {"documentID":339,"forceNotify":true,"_isCommand":false
In all other configurations (Windows with Background Saven enabled/disabled, Tasbs with Disabled Background Save):
event: close; data {"as":{"_obj":"photoshop35Format"},"in":{"_path":"/mypath","_kind":"local"},"documentID":347,"lowerCase":true,"saving":{"_enum":"yesNo","_value":"yes"},"forceNotify":true,"_isCommand":false}
The save event is not emitted. Only the close will fired after it was saved
Edited 2021-08-02 13:50
The close event is emitted before the document was saved. This only happen for ‘Open Document as Tabs’ and ‘Save in Background’