> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# On Open Document

> On Open Document は、すべてのエディターウィンドウが作成された後、FlexiCapture の文書エディターでドキュメントが開かれたときに実行されます。スクリプトからドキュメントを閉じようとしても失敗します。

<div id="when-it-is-launched">
  ## 起動のタイミング
</div>

このスクリプトは、文書エディターでドキュメントを開いたとき (新しいドキュメントウィンドウを開いたとき、または別のドキュメントに移動したとき) に起動します。

スクリプトの起動時には、文書エディター内のすべてのウィンドウはすでに作成されています。

<div id="parameters">
  ## パラメーター
</div>

| **Name** | **型**                                                                       | **アクセス**  | **Description** |
| -------- | --------------------------------------------------------------------------- | --------- | --------------- |
| Context  | [IDocumentEditor](/ja/flexi-capture/appendix/scripts-shell/idocumenteditor) | 読み取り/書き込み | 文書エディター         |

<Note>
  このスクリプトからドキュメントを閉じることはできません。**DocumentEditor.TaskWindow\.CloseEditorWindow();** コマンドを使用すると、次のエラーメッセージが表示されます。
</Note>

```
"System.Runtime.InteropServices.COMException (0x80004005): Document editor cannot be closed."
```
