How to get the document in an edit Window, when its menu is clicked?

Submitted by: Tung Fu (PTC) Last Updated: 2006-07-29

To get the document in an edit window, you can use window.activeView.document.

When you click on a menu in an edit window, the activeDocument will be updated to be the document in the window, so you can trust Application.getActiveDocument to return the document you want.