Splitting example #3

Split documents using several scripts with global variables.

  1. Create a workflow with the AutoCapture and Barcode components.
  2. On the General tab of the Barcode component configuration dialog box, select the Split on barcode check box, and select External Script in the Using box.
  3. Click the Scripts button.
  4. Click Add, and enter a file name with the .vbs extension for the first script file.
  5. Click the Edit button, and in the Script Editor window create the first script:
    Example:
    
    If Len(AllValues) > 0 Then
        AllValues = AllValues & ";" & CurValue
    Else 
        AllValues = CurValue
    End If 
    RRV ="AllValues="& AllValues
    
  6. Click Compile, save the script, and close the Script Editor.
  7. In the Script Properties dialog box, select Each page as Run condition.
  8. In Script Variables, click the Add button to configure script variables:
    Variable Description
    AllValues Global variable used by all the scripts that defines how a document should be split.
    CurValue Local variable initialized by the ~LTB::PageBarcodes~ RRT.
  9. For the second script, repeat steps 4 through 8 using the following script and variable settings.
    Example: Script:
    
    Dim values
    Dim sSplitting
    Dim bDoSplit
    values = Split(AllValues,";")
    sSplitting =" "
    For i = LBound(values) To UBound(values)
          bDoSplit = False
          If Len( values(i)) > 0 Then
                If InStr ( values(i),"5") > 0 Then
                      bDoSplit = True
                End If 
          End If 
          If Len( sSplitting ) > 0 Then
                If bDoSplit Then
                      sSplitting = sSplitting &";"
                Else 
                      sSplitting = sSplitting &","
                End If 
          End If 
          sSplitting = sSplitting & CStr(i - LBound(values) + 1)
    Next 
    RRV ="OutputPages="& sSplitting   
    
    Set the Run condition to Each document and configure the following script variable:
    Variable Description
    AllValues Value assigned by the first script to define how documents should be split.
    The second script will be executed for each document and use the AllValues value to define how a document should be split.
  10. Save the configuration and run the process.
The document will be split on each page with the barcode that contains the "5" character.