How to get the closed document?

DOCUMENTOPENED conveniently gives the opened document (I mean sender.object()), but DOCUMENTCLOSED returns GSWindowController. Is there a way to get which document was closed?

You can ask the window controller for its document (windowController.document())

1 Like

Thank you!
But seems like it gives a different id (2) from when the document is open (1):

<GSDocument: 0x600001d504e0>
<native-selector document of <GSWindowController: 0x7fc87e643230>>

It also has no document.font and other properties. Am I doing something wrong?

You need to do

windowController = document.windowContoller()

When you get a native-selector, you need to add () to the property.

Oh, got it, thank you!