app_close_document
Closes a specific open document by its full path, independent of which tab has focus. Refuses documents with unsaved edits unless changes are explicitly discarded.
Instructions
Close ONE open document, found by its full path, whatever has focus.
Unlike closing through the workspace manager, which acts on the FOCUSED object, this closes the named document itself. It refuses a document that reads modified, and says whether it is really gone afterwards. The modified read can miss edits held in the editor, so save anything you care about first; a close of an edited document may still raise Altium's save prompt.
Args: file_path: the document's full path, as app_list_documents reports it. discard_changes: close it even when it reads modified, and LOSE the unsaved edits: the modified flag is cleared first so no save prompt appears. For scratch copies and documents Altium changed by merely opening them, never for work.
Returns:
{"closed": bool, "discarded": bool, "file_path": ...}; an
error when the path is not open, or when the document reads
modified and discard_changes is not set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| discard_changes | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||