Knowledge Base

Article ID: 1485 | Category: Scanning | Type: How To | Last Modified: 8/27/2015

How to separate pages flow by several bar-code masks?


ABBYY FlexiCapture and Recognition Server allows to separate pages flow into documents or batches by a bar-code mask at the Scanning Station.

How to use two or three masks at the same time? 


The Scanning Station supplied together with ABBYY FlexiCapture 10 and Recognition Server 3.5 allows to use scripts which help to resolve the task desribed above.

To develop a script go to Batch types settings → Scripts, add a new script and select an event which will run the script.

Below, please, find a script for On page added event i.e. for each new page. The script language is JScript.  

//------------ JScript ------------
var page = this.ScriptItems.Item(0);
var mask1 = "730"; 
var mask2 = "731";
var mask3 = "253";
//Check if any of the bar-codes values satisfies one of the masks 
var brcValue = FindPageBarcodes(page).Item(0).Value.substring(0,3);
if (brcValue == mask1 || brcValue == mask2 || brcValue == mask3)
        //If yes, add a page to the new document         
        var docName = FindPageBarcodes(page).Item(0).Value;
        var newDoc = AddDocument(page, docName);        
        page.Move(newDoc, true); 
    catch (objException)
        /*This block  handles the exception in case bar-code values are the same and names 
docs as <bar-code value> 1, <bar-code value> 2 etc*/ var k = 0; var n = this.ActiveBatch.Children.Count; for (var i = 0; i < n; i++) { var bcName = this.ActiveBatch.Children.Item(i).Name.substring(0, docName.length); if (bcName == docName) ++k; } docName = FindPageBarcodes(page).Item(0).Value + " " + k; newDoc = AddDocument(page, docName); page.Move(newDoc, true); } } else { //Otherwise add a page to the old document var curDocNumber = this.ScriptItems.Item(0).Parent.Children.Count; var curDoc = this.ScriptItems.Item(0).Parent.Children.Item(curDocNumber - 1); page.Move(curDoc, false); }
352 people think this is helpful.
Was this information helpful to you?