Using Scripts in ABBYY Scanning Station

Custom scripts enable you to create your own scenarios of working with ABBYY Scanning Station. Some of the typical scenarios are as follows:

  • Placing scanned pages in the correct order after duplex scanning
  • Auto-split of large-size pages after scanning
  • Automatic filling in registration parameters for newly created batches and documents
  • Quality check of pages with an external component
  • Possibility to save pages to two export targets simultaneously, one of which can be used for back-up

Scripts can be launched both automatically (in response to certain events) and by an explicit user command.

Supported scripting languages

The following scripting languages are supported: JScript®, VBScript, C#.Net, VisualBasic.Net or JScript.Net.

Specifics of usage

In VBScript it is mandatory to use the keyword "Me" when when referring to methods and fields of a current object (the alternative of "this" in JScript, Workspace in VisualBasic.Net). In export scripts, the keyword "Me" (VBScript), "this"(JScript, C#.Net) or "Workspace" (VisualBasic.Net) implements the IExportBatch interface. In the event scripts, this keyword "Me", "this" or "Workspace" implements the IWorkSpace interface.

Working with collections

All collections support the following properties and methods:

Name Type Access Description
Count int Read-only The number of items in the collection
Item( index : int ) ItemInterface Read-only

Retrieves an item of the collection with the given index.

Enumeration begins with "0".

Instead of using the method Item you can also address items of the collection using parentheses.

For example,

Items( 1 ).Text = "Hello"

If C#.Net is used, the index is specified in brackets:

Items[1].Text = "Hello"

All collections can be used in "for each" and similar constructs.

Registry key options

For scripts launched on the ABBYY Scan Station you can change the following values in the registry:

HKEY_CURRENT_USER\Software\ABBYY\ScanStationFC\4.0\Shell\Script\DisableDebugging

HKEY_CURRENT_USER\Software\ABBYY\ScanStationFC\4.0\Shell\Script\DisableEventScripts

By default, both values are set to false.

Changing the value of "DisableEventScripts" to true prevents launching new scripts. Already running scripts are not disabled by this command.

Custom functions

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

Custom functions can be created in one of the global modules – either in the global module of events or in the global module of export. To add a custom function, click on the arrow next to the script name in the Script Editor and select GlobalModule.

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

For example, from the event script written in VBScript you can call a function contained in the global module that is written in JScript.

Functions can only be called from "their own" modules. This means that from event scripts you can only call functions contained in the global event module, and from the code of sending scripts you can only call functions contained in the global export module. Otherwise, you will get an error during execution.

25.05.2023 7:55:03

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.