Working with COM Interfaces from a Scripting Language
ABBYY FlexiCapture 12 SDK supports dynamic binding in COM interfaces: almost all ABBYY FlexiCapture 12 SDK interfaces are derived from IDispatch (the exceptions are some of the callback interfaces implemented on the client side).
Scripting languages (for example, VBScript and JScript) support only dynamic binding. Therefore, due to inheriting such interfaces from IDispatch the use of ABBYY FlexiCapture SDK from these languages does not require additional efforts.
You may load the Engine object by using the FCSDK.InprocLoader or FCSDK.OutprocLoader objects. These objects support the IEngineLoader interface, which allows you to load and unload the Engine object. In the first case FlexiCapture SDK will be loaded as an in-process server in the current process, in the latter case it will be an out-of-process server in a work process.
For example, you can create the Engine object by using the JScript ActiveXObject function.
// create the loader object var loader = new ActiveXObject( "FCSDK.InprocLoader" ); ... // get the Engine object loader.CustomerProjectId = customerProjectId; loader.LicensePath = licensePath; loader.LicensePassword = licensePassword; loader.AppDataPath = ""; var engine = loader.GetEngine();
In VBScript, use the CreateObject method:
' create loader object Dim loader Set loader = CreateObject( "FCSDK.InprocLoader" ) ... ' get the Engine object Dim engine Set engine = loader.GetEngine
In Perl, use the CreateObject method:
# create the loader object $loader = $WScript->CreateObject( 'FCSDK.InprocLoader' ); ... # get the Engine object my $Engine = $loader->GetEngine( );
After the Engine object is created, the other objects created by the methods of the Engine object named "Create..." or "Load..." can now be created and used directly from the scripting language.
Samples illustrating the use of ABBYY FlexiCapture SDK in scripting languages can be found in Samples\Hello (JScript, VBScript, Perl) (Start > Programs > ABBYY FlexiCapture 12 SDK > Code Samples Folder > Hello (JScript, VBScript, Perl)).
See also
15.08.2023 13:19:30