Split example

Split documents using several scripts with global variables.

  1. Create a workflow with the AutoCapture and OPBarcode components.
  2. On the General tab of the OPBarcode 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:
    AllValues = AllValues & ";" & CurValue
    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:
    Name Scope Initian value Description

    AllValues

    Global

     

    Global variable used by all the scripts that defines how a document should be split.

    CurValue

    Local

    ~OPB::PageBarcodes~

    Local variable initialized by the ~OPB::PageBarcodes~ RRT.

  9. For the second script, repeat steps 4 through 8 using the following script and variable settings. Script:
    Dim values
    Dim sSplitting
    Dim bDoSplit
    values = Split(AllValues,";")
    
    sSplitting = ""
    For i = (LBound(values) + 1) 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) ' page index starts from 0
    Next
    
    RRV ="OutputPages=" & sSplitting
    
  10. Set the Run condition to Each document.
  11. Configure the following script variable:
    Name Scope Initian value Description

    AllValues

    Global

     

    Value assigned by the first script to define how documents should be split.

    The second script is executed for each document and uses the AllValues value to define how to split the documents.

  12. Save the configuration and run the process.

The document is split on each page with the barcode that contains the "5" character.