Supported Scripting Languages

ABBYY FineReader Server supports scripts written in any of the following languages:

  • JScript®
  • VBScript
  • C# .Net
  • Visual Basic .Net
  • JScript .Net

Note. To be able to use .NET scripts, you need ABBYY FineReader Server 14 Update 7 or later.

Context objects are accessed differently in different scripting languages.

  • In JScript, the context object is accessed using the keyword this. (When accessing a property or calling method of the context object by its name, the keyword  this can be omitted.)
  • In VBScript the context object is accessed using the keyword Me.
  • In .NET languages, the name of the context object depends on the type of the script. In the case of a Separation script, for example, you will need to use page.

The name of the context object and its interface are displayed in the Arguments line, beneath the toolbar of the Script Editor dialog box.

The table below shows how you can access properties and call methods of the context object of a Separation script.

Language Accessing a Property Calling a Method
C# page.Width page.RemoveAllBlocks()
Visual Basic .NET page.Width page.RemoveAllBlocks()
JScript .NET page.Width page.RemoveAllBlocks()
JScript this.Width or Width this.RemoveAllBlocks() or RemoveAllBlocks()
VBScript Me.Width Me.RemoveAllBlocks()

JScript and VBScript

JScript and VBScript scripts use Active Scripting technology, which is based on OLE Automation (COM).

In the resources of the FRS.ScriptingObjects.dll module, which can be found in the Bin subfolder of the folder where ABBYY FineReader Server is installed, you can find a type library with the definitions of the interfaces and enumerations used in JScript and VBScript scripts. To view this library, you can use the OLE/COM Object Viewer utility supplied with the Windows SDK. The types contained in the type library are described in detail in this guide.

The body of a JScript or VBScript script is interpreted as the body of a function, from which the context object can be accessed using the keyword this (for JScript) or Me (for VBScript).

.NET

C#, Visual Basic .NET, and JScript .NET scripts use .NET COM Interop technology to interact with the types defined in the type library.

The corresponding interop assembly named FRS.ScriptingObjects.Interop.dll can also be found in the Bin subfolder of the folder where ABBYY FineReader Server is installed.

All the types (interfaces and enumerations) in this assembly are declared in the FineReaderServer.ScriptingObjects.Interop namespace.

The body of a .NET script is interpreted as the body of a static method that accepts the context object as the only parameter and that is declared as shown in the C# example below (this sample code is intended for a Separation script):

// References to types from the interop assembly do not need to be fully qualified in the script body
using FineReaderServer.ScriptingObjects.Interop;
public class Main
{
   // The context object is the only parameter
   public static void Execute(IRecognizedPage page)
   {
       // Script body
   }
}

20.09.2022 9:27:51

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.