Scripting interface
The KC Plug-In module contains a custom scripting interface that allows customizing how messages are imported into Kofax Capture. This is done via C# scripts. When configured, scripts run just before the content is imported into Kofax Capture and can modify or add field values or alter the binary content of the files, discard or add new binary content, or do any other alteration to the message fields or content. Additionally, scripts can, for example, make a call to a database to validate or look up data and then add looked up values to document or batch fields, or if desired abort message import and inform the Message Connector that a message has been rejected.
The KC Plug-In module can use:
-
Scripts to create specific batch names.
-
Custom document scripts to perform specific actions on the message fields or content before the message is imported into Kofax Capture.
-
Scripts to reroute portion(s) of the document to a different destination.
In addition to the KC Plug-In, a scripting DLL and a sample Visual Studio 2008 project are provided. These enable you to create, run, and test your scripts in Visual Studio before you deploy them to the KC Plug-In. Note that the provided DLL is only for making debugging easier, neither the DLL nor Visual Studio are required to create scripts. Scripts do not have to be compiled before deployment. You can also create scripts in any text editor.
The sample project KCSImportScriptingSample.zip is located in <programs>\Kofax\KIC-ED\KCPlugIn\ScriptSample\.
The scripts, though written in C#, do not need to be compiled. You have to configure the path of your script source file in the KC Plug-In configuration. When the Plug-In starts, it will build the script on the fly and run it before messages are imported or get a batch name just before the batch is created.
The batch naming script has to implement a special IBatchNameFormatter interface. If an error occurs in the script, the connector writes the error to a log file and the default batch naming configured in the batch class is used. If the script is not configured, the default batch name configured in the Kofax Capture batch class is used.
The custom document script has to implement a special IDocumentScript2 interface. It runs just before a message is imported into Kofax Capture. In the script, you can make any desired changes to the document content.
The rerouting script has to implement a special IBeforeMappingScript interface. It runs after a document is retrieved from Message Connector but before field mapping. The script has full access to the document and it can send portions of the document back to Message Connector for later retrieval.
To debug scripts using Visual Studio 2010, edit the script and add or uncomment the line
System.Diagnostics.Debugger.Break();
Additionally, open the script in Visual Studio 2010 and attach the script to the Kofax.Kcs:KcImport.exe process.