Using scripts in ABBYY FlexiCapture
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
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: For debugging scripts written in ABBYY FlexiCapture script editor, the MessageBox method can be used.
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. 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: 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:
- Place your RTL text into a user script message or an environment variable.
- Use an external assembly for your project or Document Definition (for more information, see External assemblies).
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.
Important! Script execution timeout applies for scripts written in JScript and VBScript only.
Important! To change timeouts for scripts executed under the NetworkService, you need to modify the registry branch for the corresponding user profile.
Object model
The object model is compatible with scripts created in earlier versions of ABBYY FlexiCapture.
4/12/2024 6:16:02 PM