> ## 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 Activate Document

> On Activate Document runs before a document opens in the FlexiCapture editor; set the CanOpen parameter to false in your script to block opening.

## When it is launched

The script is launched prior to activating the document in the task window (by a double-click, by using menu commands, etc.).

* If the **CanOpen.Value** property is set to **true**, the document will be opened in the document editor after the script execution.
* If the **CanOpen.Value** property is set to **false**, the document will not be opened.

By default, the value of the **CanOpen** parameter is **true**.

## Parameters

| **Name**     | **Type**                                                             | **Access** | **Description**                        |
| ------------ | -------------------------------------------------------------------- | ---------- | -------------------------------------- |
| CanOpen      | [IBoolean](/flexi-capture/appendix/scripts-shell/iboolean)           | Read/write | Specifies whether to open the document |
| Context      | [ITaskWindow](/flexi-capture/appendix/scripts-shell/itaskwindow)     | Read/write | The task window                        |
| DocumentItem | [IDocumentItem](/flexi-capture/appendix/scripts-shell/idocumentitem) | Read/write | The document being processed           |
