Script to close a DIFFERENT attached sibling document than THIS - something like app.closeDoc()
I've gained, from Gilad at this post, an understanding of how to determine the path of a given document, and to open same. I now want to selectively close a given document, of several open at the same time. I took a shot at doc.closeDoc(newPath), without success. Here's a summary:
There is a 'master' document named Parent.pdf. It contains attachments
- Son.pdf
- Daughter.pdf
- Nephew.pdf
I am able to selectively open any one, using such as
var newPath = this.path.replace(this.documentFileName, "Nephew.pdf");
app.openDoc(newPath);
I now want to have a button, in any attachment but Nephew.pdf, which will close Nephew.pdf. I do not find such a thing as an inverse, i.e. – app.closeDoc(). I am aware of variations on this.closeDoc. But I wish to close THAT Doc. I have read reference in the SDK to using doc.closeDoc, but in the context of a newly created, newly named, doc [newDoc.closeDoc() ]. I need to act on an existing attachment, which is already open. I do not know how to properly refer to it [or its path]. And then to Close.
I have a general sense as to potentially crossed wires, in what I have crudely tried. I can smell that there's a problem in managing ths.path, when I am in fact interested in THAT.path. The script
var newPath = this.path.replace(this.documentFileName, "Nephew.pdf");
doc.closeDoc(newPath)rerturns
ReferenceError: doc is not defined
TypeError: app.closeDoc is not a function
ReferenceError: doc is not defined
ReferenceError: doc is not defined
And I assume that this.path is largely moot, in re managing OTHER documents ?
Guidance is welcomed.
