×
Menu
Index

9.1.1. ChronoApp

 
The ChronoApp object gives access to the ChronoScan application: ChronoScan variables, global and user variables, dialogs and messages, global lists, the batches of the job, the indexing interface (Indexer_* methods), the Enterprise user, e-mail and the external services configured in the Administration tab.
It is available in every script: job events, document and field events, customizable buttons, hot folder and scheduled tasks, and stand-alone scripts run with the -vbs command line option.
 
Methods
Returns
Method
Description
short
AddEntity
(string id, string name, string description = "")
Creates an entity (ChronoScan Enterprise) with the given id, name and description. Returns 1 if created.
void
AddToOutputWindow
(string addstr)
Add the string to the ChronoScan trace window
Example
ChronoApp.AddToOutputWindow(value)
void
CancelEventExecution
()
Since v1.0.2.97
Stops the event post execution
void
Clean
()
Clears the caches and temporary objects of the application; call it at the start of a standalone (-vbs) script.
void
CloseBatch
(object batch)
Closes and saves a batch object obtained with CreateBatch or GetCurrentBatch (standalone scripts).
string
cmdline_GetValue
(string sKey)
Returns the value of a command line key (for example the value of -mykey=value when ChronoScan was started from the command line).
Parameters
sKey (string): The name of the key to be retrieved
Example
Dim res = ChronoApp.cmdline_GetValue(KeyName)
short
cmdline_HasKey
(string sKey)
Parameters:
String KeyName, the name of the key to be check
Return:
short, 1 if the key exist on the command line, or 0 elsewhere.
short
cmdline_HasVal
(string sKey)
Parameters:
String KeyName, the name of the key to be check
Return:
short, 1 if the key exist and has value on the command line, or 0 elsewhere.
short
ConvertEmlBodyToPdf
(string emlfile, string pdfFile)
Since v1.0.2.97
Funcion to convert an eml file to pdf
Parameters
emlfile (string): Path to the eml file
pdfFile (string): Path to the pdf file
Returns: 0: fail, 1: success
Example
ChronoApp.ConvertEmlBodyToPdf("path/to/eml/file", "path/to/pdf/file")
object
CreateAdoDBConnection
(string connectString, string usrId, string usrPwd)
Take a look at this good article by Carlos Antollini (https://www.codeproject.com/Articles/2304/ADO-Connection-Strings) to configure your DSN.
usrId, optional username if you don't set it on your DSN
Parameters
connectString (string): ADODB String connection
usrId (string) optional: Optional username if you don't set it on your DSN
usrPwd (string) optional: Optional password if you don't set it on your DSN
Returns: ChronoScan will maintain this database open for you, don't call mydb.Close
object
CreateBatch
(string JobName, string BatchName)
Create a new Batch. If the batch name already exists, that object will be returned.
Parameters
JobName (string): Name of the database connection on the ChronoScan database manager
BatchName (string) optional: Blank to use default name
Returns: ChronoBatch object
Example
Set batch = ChronoApp.CreateBatch(JobName, BatchName)
short
CreateUserVariable
(string VariableName, string Value)
Create a new user variable
User variables are stored in ChronoScan configuration and can be used in any script
Parameters
VariableName (string): You can see a complete variable list in the variables wizard window of ChronoScan.
Value (string)
Returns: 0 = Fail, 1 = Success
Example
Dim val
val = ChronoApp.CreateUserVariable(variable_name, variable_value)
short
dlg_seloption_add_column
(string colname, string flags)
Add a column to the options dialog
Parameters
colname (string): name of the column
flags (string): flags for the new column:
sz:100 (size in pixels)
align:Left (column align Left,Center,Right)
Combine flags using | (ex sz:100|align:Right)
Returns: column id (1 based)
short
dlg_seloption_add_row
(string rowdata)
Add a new row to the options dialog
Parameters
rowdata (string): Data value associated with this row, will be the return value of the dialog
Returns: column id (1 based)
short
dlg_seloption_prepare
(string title, string description)
Prepares (clears) the options dialog and sets its title and description; then add columns and rows and call dlg_seloption_show.
void
dlg_seloption_setparam
(string param, string value)
Reserved for future options
void
dlg_seloption_setrowtext
(short rowid, short colid, string rowtext)
Sets row/column text
Parameters
rowid (short): (1 based)
colid (short): (1 based)
rowtext (string): text to show on the grid
string
dlg_seloption_show
()
Shows an option dialog to allow the user to select between different options
Returns: rowdata of the selected item
void
DoctypeCreate_DlgOpen
(string doctypeName = "")
Opens the Create document type dialog for the current document, optionally with a proposed name.
short
DownloadFileInBrowser
(string file)
Downloads a local server file when ENT application mode
Returns: 0 = Fail, 1 = Success
Example
Dim resres = ChronoApp.DownloadFileInBrowser(file_name)
string
ent_GetCurrentUserVariable
(string param)
Get a custom user variable value for the logon user (enterprise version only)
Parameters
param (string): (user variables should start with "uservar.")
ChronoScan Enterprise only.
Example
ChronoApp.ent_GetCurrentUserVariable("uservar" & variable_name)
void
ent_SetCurrentUserVariable
(string param, string value)
Set a custom user variable value for the logon user (enterprise version only)
Parameters
param (string): (user variables should start with "uservar.")
value (string)
ChronoScan Enterprise only.
Example
ChronoApp.ent_SetCurrentUserVariable("uservar" & variable_name, variable_value)
short
ExternalDataImportExecute
(string confname)
Runs an External data import configuration (Administration tab, Import extern data) by name. Returns 1 if the import ran.
string
FileSaveAs
(string file)
Shows a Save As dialog (desktop) or a download (web) for the given file and returns the destination path, or an empty string if the user cancels.
variant
GetBatches
(string job)
Get a list of batches
Example
batchesArray = ChronoApp.GetBatches("ENT_TUTORIAL")
For Each strBatch In batchesArray
    msgbox strBatch
Next
variant
GetBatches2
(string job)
Returns an array with the batches of a job including their status (see GetBatches for the basic list). Enterprise batches include the server status.
string
GetCaptureDateFormat
()
Returns the date format used by the station to capture dates (for example dd/MM/yyyy).
object
GetChronoScanDBConnection
(string name, string uid, string pwd)
Returns a connection to a database
Parameters
name (string): Name of the database connection on the ChronoScan database manager
uid (string) optional: Optional username if you don't set it on your DSN
pwd (string) optional: Optional password if you don't set it on your DSN
Returns: ChronoScan will maintain this database open for you, don't call mydb.Close
object
GetCurrentBatch
()
Get currently opened Batch object
Example
Set ChronoBatch = ChronoApp.GetCurrentBatch()
object
GetCurrentJob
()
Since v1.0.2.96
Returns current opened job
Returns: ChronoJob: object (https://chronoscan.org/doc/chronojob.htm)
Example
Set job = ChronoApp.GetCurrentJob()
msgbox job.JobName()
string
GetCurrentUserId
()
Returns the id of the user running the script (ChronoScan Enterprise); empty on a desktop station without Enterprise session.
string
GetGlobalVariable
(string VariableName, string Default)
Global variables are stored in ChronoScan and they can be used in whatever script.
These variables are temporary variables and they will be deleted at the end of
your ChronoScan session.
Parameters:
String VariableName
String DefaultValue
Returns a requested global variable
object
GetMFilesServerApplication
(string ConnectionName, short cacheconnection = 0)
Returns the M-Files server application object (M-Files COM API) of one of the M-Files connections defined in the Administration tab, so the script can use the M-Files API directly. cacheconnection=1 keeps the connection open between calls.
string
GetUserEmail
(string userid)
Since v1.0.2.96
Returns the user email provided user id (enterprise)
Returns: User Email
ChronoScan Enterprise only.
Example
Dim uEmail
uEmail = ChronoApp.GetUserEmail(userid)
string
GetUserId
(string username)
Since v1.0.2.96
Returns the user id of a provided user name (enterprise)
Returns: User id
ChronoScan Enterprise only.
Example
Dim uid
uid = ChronoApp.GetUserId(username)
string
GetUserName
(string userid)
Since v1.0.2.96
Returns the user name of a provided user id (enterprise)
Returns: User name
ChronoScan Enterprise only.
Example
Dim uname
uname = ChronoApp.GetUserName(userid)
string
GetUserType
(string userid)
Since v1.0.2.96
Returns the user type of a provided user id (enterprise).
Returns: User type
ChronoScan Enterprise only.
Example
Dim utype
utype = ChronoApp.GetUserType(userid)
string
GetUserVariable
(string VariableName)
Returns the value of a user variable of the station (see SetUserVariable and CreateUserVariable).
string
GetVariableValue
(string variable)
Returns a ChronoScan variable
Parameters
variable (string): You can see a complete variable list in the variables wizard window of ChronoScan
Returns: Variable value
Example
Dim val
val = ChronoApp.GetVariableValue(variable_name)
short
GlobalListAdd
(string ListName, variant values)
Global variables are stored in ChronoScan and can be used in whatever script.
These variables are temporary variables and they will be deleted at the end of your ChronoScan session
Returns: 0 = Fail, 1 = Success
Example
Dim arrValues
arrValues=Array ("str value 1", Now , 2222, 222.5, "str value 2")
Call ChronoApp.GlobalListAdd("my list", arrValues)
short
GlobalListClean
(string ListName)
Cleans the list, removing all records
Returns: 0 = Fail, 1 = Success
Example
Dim resres = ChronoApp.GlobalListClean("my list")
variant
GlobalListGet
(string ListName, long position)
Returns a row for a global list Global lists are stored in ChronoScan and can be used in whatever script.
These lists are temporary lists and they will be deleted at the end ofyour ChronoScan session
Returns: Array with all the columns
Example
numRow=0
myArray = ChronoApp.GlobalListGet("my lists", numRow)
For i = 0 To UBound(myArray)
     msg=msg & "|" & myArray(i)
Next
MsgBox msg
short
GlobalListRemove
(string ListName, long position)
Removes a row of a global list
Returns: 0 = Fail, 1 = Success
Example
Dim resres = ChronoApp.GlobalListRemove("my list", RowNumber)
long
GlobalListSize
(string ListName)
Returns the number of rows of a global list
Returns: Rows count
Example
Dim resres = ChronoApp.GlobalListSize("my list")
short
Indexer_CloseBatch
()
Asks the indexing interface to close the current batch when the script finishes. The return value is reserved.
short
Indexer_CloseBatchNOW
()
Closes the batch open in the indexing interface immediately. The return value is reserved.
void
Indexer_FilterDocuments
(string Field, string value, string condition = "=")
Filter the visible documents
Parameters
Field (string)
value (string)
condition (string) optional: "=" default
Example
'Filter by "Invoice total" greater than 10
ChronoApp.Indexer_FilterDocuments("Invoice total", 10, ">")
short
Indexer_GetEntStage
()
Returns the Enterprise workflow stage of the batch open in the indexing interface.
variant
Indexer_GetSelectedRows
()
Returns the selected rows on UI grid panel
Example
myArray = ChronoApp.Indexer_GetSelectedRows()
For i = 0 To UBound(myArray)
    msg=msg & "|" & myArray(i)
Next
MsgBox msg
void
Indexer_GotoPage
(short page)
Go to a page number
Parameters
page (short): Page number
Example
ChronoApp.Indexer_GotoPage(2)
short
Indexer_HideField
(string FieldName)
Hides a visible field
Parameters
FieldName (string): (It allows several fields "field1|field2|field3")
Example
ChronoApp.Indexer_HideField(field)
void
Indexer_HighlightZone
(string rect, long cColor = 0)
Highligh a zone
Parameters
coords (string): coordinates, format: "x,y,sx,sy"
Example
ChronoApp.Indexer_HighlightZone("x, y, sx, sy")
short
Indexer_OpenBatch
(string jobname, string batchname)
Open the specified job/batch on the indexer
Parameters:
string: jobname
string: batchname
short
Indexer_SelectDocNum
(long docnum)
Select a specific document number on index panel
Parameters
docnum (long): Document number
Returns: document number
Example
ChronoApp.Indexer_SelectDocNum(docNum)
void
Indexer_SelectFirstDoc
(short status)
Select first document on index panel
Parameters
status (short): 3=all, 0=validated, 1=error
Example
ChronoApp.Indexer_SelectFirstDoc(status)
void
Indexer_SelectLastDoc
(short status)
Select last  document on index panel
Parameters
status (short): 3=all, 0=validated, 1=error
Example
ChronoApp.Indexer_SelectLastDoc(status)
short
Indexer_SelectNextDoc
(short status)
Select next document on index panel
Parameters
status (short): 3=all, 0=validated, 1=error
Example
ChronoApp.Indexer_SelectNextDoc(status)
void
Indexer_SelectNextPage
()
Open next page on index panel
Example
ChronoApp.Indexer_SelectNextPage()
short
Indexer_SelectPrevDoc
(short status)
Select previous document on index panel
Parameters
status (short): 3=all, 0=validated, 1=error
Example
ChronoApp.Indexer_SelectPrevDoc(status)
void
Indexer_SelectPrevPage
()
Open previous page on index panel
Example
ChronoApp.Indexer_SelectPrevPage()
short
Indexer_SetFocus
(string FieldName)
Set focus to field on Index panel
Example
ChronoApp.Indexer_SetFocus(field)
short
Indexer_ShowField
(string FieldName)
Shows a hidden field
Parameters
FieldName (string): (It allows several fields "field1|field2|field3")
Example
ChronoApp.Indexer_ShowField(field)
short
Indexer_ShowXGridPanel
(short state = 1)
Since v1.0.2.99
Shows or hides the xGrid panel on index mode
Parameters
state (short): 1 => Show, 0 => Hide
ChronoScan Enterprise only.
Example
'Show panel
Call ChronoApp.Indexer_ShowXGridPanel(1)
'Hide panel
Call ChronoApp.Indexer_ShowXGridPanel(0)
string
Indexer_XGridAddRow
(short panel)
Adds a row to a grid panel (1-4) of the current document in the indexing interface. The return value is reserved.
string
Indexer_XGridGetSelectedRowColValue
(short panel, string col)
Returns the value of a column of the row currently selected in a grid panel (1-4) of the indexing interface.
short
Intellitag_ImportSingleItem
(string listName, string item)
Runs one item of an Intelli-Tag import configuration: imports the tags for the given value into the list. Returns 1 on success.
variant
MFilesGetSearchResults
(string searchname, long maxResult = 0)
Runs one of the M-Files searches defined in the Administration tab (M-Files Searches) and returns the objects found as an array. maxResult limits the number of results (0 = no limit).
long
MsgBox
(string title, string text, long buttons, long icon)
Shows a MsgBox compatible with web and services interfaces
Parameters
title (string): Message title
text (string): Message body text
buttons (long): Buttons to show (same as VBScript MsgBox function)
icon (long): Icon to show (same as VBScript MsgBox function)
Returns: Same as VBScript MsgBox function
Example
 ChronoApp.MsgBox "Warning", "This is the message Body text", OKOnly, Exclamation
long
MsgBoxTimeout
(string title, string text, long buttons, long icon, long seconds)
Shows a auto close MsgBox compatible with web and services interfaces.
Parameters
title (string): Message title
text (string): Message body text
buttons (long): Buttons to show (same as VBScript MsgBox function)
icon (long): Icon to show (same as VBScript MsgBox function)
seconds (long): Number of seconds to wait for close the message
Returns: Same as VBScript MsgBox function
Example
 ChronoApp.MsgBoxTimeout "Warning", "This is the message Body text", OKOnly, Exclamation, 5
short
OpenLinkInBrowser
(string uri)
Since v1.0.2.70
Open a web browser new window with the specified url
Parameters
uri (string): url to open
Example
ChronoApp.OpenLinkInBrowser("https://www.chronoscan.org")
void
RefreshBatchesPanel
(short reloadList = 1)
Refreshes the Batches panel of the desktop interface. reloadList=1 reloads the whole list (shows new batches), 0 only refreshes the existing rows.
short
RenderPdfToImage
(string pdfFile, string imageFile, string pages = "1", string renderer = "", string resolution = "200")
Renders pages of a PDF file straight to image files, without importing or analyzing the PDF (fast). renderer: empty = station configuration, Xfinium, GdiPlus, Quadrifoglio or Poppler. An imageFile with .tif extension renders a black and white TIF, any other extension renders a color JPG; when several pages are rendered the extra ones get a _00002 style suffix. Returns the number of pages rendered (0 = error).
short
SendSmtpEmail
(string From, string FromName, string To, string CC, string BCC, string Subject, string Body, string attachements)
Send an email using the glogal smtp settings
Parameters
From (string)
FromName (string)
To (string)
CC (string)
BCC (string)
Subject (string)
Body (string)
attachements (string): (Full path to a file, several files split by ";")
Returns: 1 if success, or 0 error
void
SetCaptureMode
()
Change to capture window
Desktop only (not available in the web client).
Example
ChronoApp.SetCaptureMode()
void
SetGlobalVariable
(string VariableName, string Value)
Global variables are stored in ChronoScan and can be used in whatever script.
These variables are temporary variables and they will be deleted at the end of your ChronoScan session
Example
Dim val
val = ChronoApp.SetGlobalVariable(variable_name, variable_value)
void
SetIndexMode
()
Change to index window
Desktop only (not available in the web client).
Example
ChronoApp.SetIndexMode()
short
SetUserVariable
(string VariableName, string Value)
Sets the value of an existing user variable. User variables are stored in ChronoScan configuration and can be used in any script.
New variables can be added through "Program settings" in administration tab to obtain the value of an user variable, use the function GetVariableValue("uservariable.variablename")
Parameters
VariableName (string): You can see a complete variable list in the variables wizard window of ChronoScan.
Value (string)
Returns: 0 = Fail, 1 = Success
Example
Dim val
val = ChronoApp.SetUserVariable(variable_name, variable_value)
void
ShowToast
(string message, long seconds = 5, string severity = "info")
Shows a non-blocking toast message on desktop and web. severity: info (green), warning (orange) or error (red); seconds = how long it stays visible.
short
SmtpRelayMsg
(string emlfile, string From, string To, string CC = "", string BCC = "")
Re-sends an existing .eml message through the SMTP server of the station, replacing the sender and the recipients. Returns 1 on success.
short
UploadFileInBrowser
(string file)
Web client: lets the user upload a file from the browser to the given path. The return value is reserved.
void
Viewer_SetThumbnailsSize
(short size)
Change Viewer's Thumbnail's size
Parameters:
short size, 1=title only, 2=small, 3=medium, 4=big