×
Menu
Index

3.6.1.5. ChronoDocument

v78 or greater
 
The ChronoDocument object will usually be available when editing a script.
It will give you access to the object corresponding to the currently selected document.
It is also possible to get the ChronoDocument object for a certain document by using ChronoBatch.GetDocument.
 
Methods:
 
Type
Method
Description
Short
AddPage
Description:
   Adds a new page from a file
 
Parameters:
   String file
 
Short
EntAddToEventLog
Description:
    Adds a new entry in the ChronoScan Enterprise event log for the document
 
Parameters:
   String description
 
String
GetVariableValue
Description:
   Returns a ChronoScan variable, it includes variables related with the document
 
Parameters:
   String variable - Requested variable to ChronoScan, for example "station_id"
 
You can see a complete variable list in the variables wizard window of ChronoScan.
 
Return value for the selected ChronoScan variable.
String
get_field_value
Use the field name as it appears on the ChronoScan Data entry form under "Page fields" or "System fields"
Using ChronoDocument.get_field_value(Guid) you can get the unique identifier
ChronoDocument.get_field_value($size_in_bytes) will return the file size for the entire document
 
Parameters :
 
   String field - The user or system field name
 
Returns the field value
 
String
set_field_value
Sets the field value
Use the field name as it appears on the ChronoScan Data entry form under "Page fields" or "System fields"
 
Parameters :
 
   field - The user or system field value
   value - The new value for the field
 
 
 
GetField
Return UserField object of a specific field
 
Parameters:
 
   String field name
 
GetFieldIdx
Return UserField object of a specific field
 
Parameters:
 
   short field idx (starting by 0)
 
Short
GetFieldCount
Returns the number of fields in a document
String
get_page_field_value
Returns the field value of the page (1 based index)
Use the field name as it appear on the ChronoScan Data entry form under "Page fields" or "System fields"
 
Parameters :
   page - The page number
   field - The user or system field value
 
Short
get_page_count
Returns the number of pages of the document
 
Long
GetDocNumber
Returns the current document number
 
Short
IgnorePage
Toggles ignored status on the desired page
 
Parameters:
 
   Short page number
   Bool - 1 sets page as ignored; 0 sets page as not ignored
 
Return
 
   TRUE if success
Short
AddXgridRow
Adds a new row on the grid
 
Parameters:
 
   Short table number
 
Return
 
   TRUE if success
 
String
GetXgridFieldValue
Returns the value of a specific capture grid field
 
Parameters:
 
   Short table number
   Short table row number
   String Field name
 
 
String
SetXgridFieldColor
Set the color of a specific capture grid field
 
Parameters:
 
   Short table number
   Short table row number
   String Field name
   long color:  -1 removes the color to default, RGB(red,green,blue) to specify a color
 
Example:
 
  'Grid 1, Row 3, Field "Details line" and RGB color 0,255,0 (Green)
  Call ChronoDocument.SetXgridFieldColor(1, 3, "Details line", rgb(0,255,0))
 
Short
SetXgridFieldValue
Set the value for a specific capture grid field
 
Parameters:
 
   Short table number
   Short table row number
   String Field name
   String new value
 
String
GetXgridColumnValue
Returns the value of a specific capture grid field by column number
 
Parameters:
 
   Short grid number
   Short grid row number
   Short column number
 
Short
GetXgridFieldBitmap
Saves the zone bitmap of a specific capture grid field to a file
 
Parameters:
 
   Short table number
   Short table row number
   String Field name
   String Destination file
 
Return
 
   TRUE if success
 
 
Short
GetXgridRowCount
Returns the number of records of a specific capture grid
 
Parameters:
 
   Short table number
 
 
Short
GetXGridSelectedRows
Returns an array containing the selected rows in an specific XGrid
 
Parameters:
   Short table number
 
Sample:
 
GridPanel=1 'first panel
RowsArray = ChronoDocument.GetXGridSelectedRows(GridPanel)
For i = 0 To UBound(RowsArray)
    MsgBox "Row: "&RowsArray(i)&" is selected"
Next
 
Short
DeleteXgridRow
Removes a row from the grid
 
Parameters:
 
   Short grid number
   Short grid row number
 
Void
XgridClearContent
Clear capture grid content
 
Parameters:
 
   Short grid number
 
Short
SplitOnPage
Splits a document in a specific page
 
Parameters:
 
   Short page number
 
Short
DeletePage
Deletes a specific page
 
Parameters:
 
   Short page number
 
Void
set_doctype_param
Set a document type custom value
 
Parameters:
 
   item - Name of the item to set
   value - Value of the item to set
 
Sample:
 
Call Document.set_doctype_param("CALCTAXES", "true")
 
String
get_doctype_param
Reads a document type custom value
 
Parameters:
 
   item - Name of the item to get
   defvalue - Default value if not set
 
Sample:
 
taxes = Document.get_doctype_param("CALCTAXES", "false")
 
Void
set_masterkey_param
Set a master key custom value
 
Parameters:
 
   item - Name of the item to set
   value - Value of the item to set
 
Example:
 
Call ChronoDocument.set_masterkey_param("CURRENCY", "EUR")
 
String
get_masterkey_param
Reads a master key custom value
 
Parameters:
 
   item - Name of the item to get
   defvalue - Default value if not set
 
Example:
currency = ChronoDocument.get_masterkey_param("CURRENCY", "USD")
 
Void
Validate
Forces validation
 
Short
GetValidateStatus
Returns the validation status
 
Parameters:
 
Return
 
   0=error
   1=validated
 
Short
SetDocumentType
Forces a document type
 
Parameters:
 
   Document type name
 
Return
 
   TRUE if success
 
Example:
 
res = ChronoDocument.SetDocumentType("DOCUMENT TYPE NAME")
 
Short
CreateNewDocumentType
Creates and forces a document type
 
Parameters:
 
   Document type name, null if default name
 
Return
 
   TRUE if success
 
Example:
 
res = ChronoDocument.CreateNewDocumentType("NEW DOCUMENT TYPE NAME")
Short
GetDocFirstSelectedPage
Return the first page of a selection
  
Return
 
   First selected page index (starts at 0)
 
Sample:
 
SelectedPage = ChronoDocument.GetDocFirstSelectedPage + 1
 
String
get_doc_hash
Returns a hash for the document based on all page hashes
 
Return:
 
    Page hash
 
String
get_doc_page_hash
Returns a hash for the specified page
 
Parameters:
 
    Page index (1 based)
 
Return:
 
    Page hash
 
Short
GetZoneFieldBitmap
Saves the zone bitmap of a specific field to a file
 
Parameters:
 
   String Field name
   String Destination file
 
Return
 
   TRUE if success
 
Short
GetZoneFieldJpg
Saves the zone jpg of a specific field to a file
 
Parameters:
 
   String Field name
   String Destination file
 
Return
 
   TRUE if success
 
String
GetFullOcr
Returns the full ocr text for a whole document or a single page
 
Parameters:
 
   Short : page => -1 all pages
   Short : mode => 0=unformatted, 1=formated
 
Return
 
   OCR Text
 
Array (two dimensions)
GetIntellitagCandidates
Returns a two dimensional array with all the candidates for the selected intellitag list and the related information
 
Parameters:
 
   String, data field name. Insert the name of the field that is linked to the desired intelli-tag list.
   Optional, only accepts 0 or 1. When set to 1 it ignores duplicates by selecting only the highest scoring results. 0 is the default value.  
 
Return
 
   Two dimentional array, the first dimension will contain the details and the second dimension is the line number:
0. Intelli-tag search string, the string being searched for
1. Intelli-tag label search result, the string found on the document
2. Intelli-tag function search result, the result of the search function or static value
3. Page number, the page number where the intelli-tag was found
4. Score, the score for the current intelli-tag
5. Boolean, highest score. If 1 the current intelli-tag is the highest score
6. User value 1
7. User value 2
8. User value 3
 
Sample:
 
'Get candidates for the AllowCharge intelli-tag list with option 1 which means removing duplicates by choosing the one with the highest score
candidatesArray = ChronoDocument.GetIntellitagCandidates("AllowCharge",1)
 
'Put the results on xgrid 2
xgridNum=2
 
Call ChronoDocument.XgridClearContent(xgridNum)
 
For i = 0 To UBound(candidatesArray)
 
    Call ChronoDocument.AddXgridRow(xgridNum)
    Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "DESCRIPTION", candidatesArray (i,0))
    Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "TOTAL AMOUNT", candidatesArray (i,2))
    Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "Page Number", candidatesArray (i,3))
 
    'Set CODE in Grid 2 according to Credit field. This uses the User Values that can be added to any intelli-tag
    If UserField_Credit.value="no" Then
        Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "CODE", candidatesArray (i,6))
        ElseIf UserField_Credit.value="yes" Then
        Call ChronoDocument.SetXgridFieldValue(xgridNum, i, "CODE", candidatesArray (i,7))
    End If
 
Next
 
Short
LookupForceValidation
Forces the validation of a lookup or all lookups
 
Parameters:
 
   String Lookup name (empty validates all lookups)
 
Return
 
   TRUE if success
 
Short
SetDocumentAsIndexed
Set document as indexed in a ENT system
 
Parameters:
 
Return
 
   TRUE if success
 
Void
SaveToPDF
Save the documento to a pdf file
 
Parameters:
 
   String pdf file
   Short Include text, 1=include tex, 0=exclude text (default 1)
   String  pdf type, "ChronoScan", "Nuance" (default "ChronoScan")
   Short use original pages, 0 or 1 (default 0)
 
Sample:
 
   ChronoDocument.SaveToPDF("c:\temp\file saved from vbscript.pdf")
   'This will save the current document inside the specified path
 
Void
reprocess
Reprocess the current Document object
 
Sample:
 
   If Not UserField_Invoice_Total.ValidateStatus = 1 Then Call ChronoDocument.reprocess
 
Short
MoveDocument
Moves the document to a position
 
Parameters:
       Short new position
 
Return
 
   TRUE if success
Short
MovePage
Moves a page to a specified position
 
Parameters:
   int: page
   int: position
 
*First page is 1
 
Returns:
   1 if success
   0 if not success
 
String
FullOCR
Rebuild document OCR using an specific engine
 
Parameters:
 
OCR Engine (string) supporting any of this options:
  • "ChronoScan OCR"
  • "Nuance"
  • "gocr" (Google Vision)
  • "Tesseract (free)"
 
Flags (string):
          Reserved.
 
Return:
    A string describing result
 
Ex:
    ChronoDocument.FullOCR ("gocr", "")
 
short
IgnorePage
Ignores/ unignores a specific page
 
Parameters:
  int pagenumber (indexed from 1)
  int mode:
       0: Not ignored/ Unignore
       1: Ignore
 
Returns:
   TRUE if success
 
short
IsPageIgnored
Tells us if a specific page is ignored
 
Parameters:
  int pagenumber (indexed from 1)
 
Returns:
   TRUE if ignored
    FALSE if not ignored
short
Ignore
Ignores/ unignores the document
 
Parameters:
  int mode:
       0: Not ignored/ Unignore
       1: Ignore
 
Returns:
   TRUE if success
 
short
IsIgnored
Tells us if the document is ignored
 
Parameters:
 
Returns:
   TRUE if ignored
    FALSE if not ignored
short
ExecuteConversionModule
Execute a conversion module and its child conversion/output modules. The module will execute even if it is not active
 
Parameters:
      string module name: configured conversion module name
 
Returns:
   TRUE if success
 
String
GetEntStatus()
*Since v1.0.2.96
Description:
 
Returns the enterprise document status
 
Returns:
  Document status: String
 
 
Short
SetEntStatus(<string> status)
*Since v1.0.2.96
Description:
 
It sets an enterprise document status
accepted status:
  toprocess, toreprocess, topreclass, topostclass, toreview, toconfigure, manual_index,
  exported, rejected, approved, system_indexed, user_indexed, processed
  *waiting_approval, *approved, *rejected
 
*Only for jobs with approval workflow active
 
Returns
  1: success
  0: error
 
 
 
Short
Approve()
*Since v1.0.2.96
Description:
 
  Approves a document (approval workflow)
 
Returns
  1: success
  0: error
 
 
*Only for jobs with approval workflow active, otherwise it will return 0
 
Short
Reject(<string>? reason)
*Since v1.0.2.96
Description:
 
  Rejects a document (approval workflow)
 
Params:
  reason: string (optional)
 
Returns
  1: success
  0: error
 
 
*Only for jobs with approval workflow active, otherwise it will return 0
 
Short
SendToRevise(<string>? reason)
*Since v1.0.2.96
Description:
 
  Sends a document to revise again (manual_index), (approval workflow)
 
Params:
  reason: string (optional)
 
Returns
  1: success
  0: error
 
 
*Only for jobs with approval workflow active, otherwise it will return 0
 
Short
SetApprover(<string> userid)
*Since v1.0.2.96
Description:
 
  It sets an specific user as an approver for the current ChronoDocument (enterprise)
 
* The job must have approval workflow active
* The user id must be a valid approver user for this job
 
Params:
  user id: string
 
Returns
  1: success
  0: error