> ## 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.

# Using scripts in ABBYY FlexiCapture

> Use scripts to customize processing stages and station interfaces in ABBYY FlexiCapture: supported languages, custom functions, timeouts, object model.

This section describes how to use scripts for customizing processing stages and the stations interface in ABBYY FlexiCapture.

## Supported scripting languages

ABBYY FlexiCapture supports the following scripting languages: **C#.Net**, **VisualBasic.Net**, **JScript.Net**, **JScript®**, **JScript.Compact** and **VBScript**.

[Specifics of scripts written in .Net languages](/flexi-capture/appendix/scripts/dot-net)

## Specifics of usage

In VBScript it is mandatory to use the keyword "Me" when passing a **NULL** value (the alternative of "this" in JScript), while in .Net languages the **NULL** value is passed as an ordinary parameter.

For each script, access permissions for all its parameters are originally known. Access permissions determine the subset of methods that are available from scripts. When addressing the object methods, permissions for returned objects are always inherited from the source object (exceptions from this rule are described in comments to the corresponding methods).

<Note>
  Script objects cannot be used after completion of the script because of indeterminate object behavior.
</Note>

<Tip>
  For debugging scripts written in ABBYY FlexiCapture script editor, the **MessageBox** method can be used.
</Tip>

## <a id="customfunction" />Custom functions

The script editor allows users to create their own functions and procedures and then to call them from the code of scripts.

Custom functions and procedures should be written to the global module, which can be accessed from the [Script Editor](/flexi-capture/interface/script-editor). For this, from the drop-down list on the toolbar of the script editor, select an available global module: Rule Global Script Module, Export Global Script Module, **Events** or **NonInteractiveProcessor**.

All functions within one module must be written in the same language. The core code of a script can be written in a language different from that used in the corresponding global module.

Global functions written in **JScript®**, **JScript.Compact** and **VBScript** scripting languages can be called from scripts also written in one of these languages. For example, from the code of a rule written in VBScript you can call a function contained in the global module that is written in JScript.

Global functions written in .Net languages can be called from scripts which are written in one of .Net languages (**C#.Net**, **VisualBasic.Net** or **JScript.Net**).

To call a function from its global module, a corresponding prefix (**Rules**, **Export**, **Events** or **NonInteractiveProcessor**) must be used. For example, the function **DoSomething** from the Rule Global Script Module module must be called as follows: **Rules.DoSomething ()**.

<Note>
  For scripts written in .Net languages, functions from global modules are called by their names without using prefixes.
</Note>

<Note>
  You cannot use RTL languages for text constants in the script editor. If you need to add RTL text into your script, use one of the following workarounds:
</Note>

1. Place your RTL text into a [user script message](/flexi-capture/templates/localization) or an environment variable.
2. Use an external assembly for your project or Document Definition (for more information, see [External assemblies](/flexi-capture/appendix/scripts/user-assembly)).

## Script execution timeout

The default timeouts are 30 seconds for export and 10 seconds for other scripts.

To change the default timeouts, specify the following value in the registry:

HKEY\_CURRENT\_USER\Software\ABBYY\FlexiCapture\12.0\Controller\ScriptSupport\DefaultScriptTimeout

The value of a timeout in the registry is specified in milliseconds. If a script takes longer to execute than the specified timeout, it will be terminated and an error message will be returned "Script execution timeout". If the script is a part of import, recognition or export task, a similar error message will be recorded in the log.

<Note>
  Script execution timeout applies for scripts written in JScript and VBScript only.
</Note>

<Warning>
  To change timeouts for scripts executed under the NetworkService, you need to modify the registry branch for the corresponding user profile.
</Warning>

## Object model

The object model is compatible with scripts created in earlier versions of ABBYY FlexiCapture.

[Read more about the object model](/flexi-capture/appendix/scripts/scripting-model)
