FXXSMSCAN Special Process
The FXXSMSCAN process scans a nominated folder for subfolders containing subfolders named with a .XSM extension. The .XSM subfolder must contain a single .DAT file and a single .XST file, named with the same filename part as their subfolder. The .DAT file must contain one or more filenames of .TIF files, which must reside in the same .XSM subfolder. The XST file must contain the fax number to which the file is to be sent.
To allow customization of the text extraction, the fields to be extracted from the XST file can be specified using 'regular expressions' to match patterns in the file. Some useful information about regular expressions can be found at http://www.regular-expressions.info.
The setup screen for this process selects the base folder to be scanned and the USR file which will be used to send the document.
The USR file should include FS template items on $fs_template commands. These commands, and USR $var_def commands are scanned for a substring REGEX: followed by a regular expression, all in double-quotes. The regular expression must create a subexpression (backreference) using either the special name FAXNUM (which specifies the destination) or the special name ROUTETO (which specifies the receiver name) or any other backreference name which must match the variable name with which the regular expression is associated.
The commands scanned are:
•The regular expression on a $fax_phone command is assumed to produce a named subexpression (backreference) with name FAXNUM. An example of a regular expression might be:
$fs_template $fax_phone "REGEX:^\s*string PhoneNumber = ""(?<FAXNUM>(?:\d|-|\+|\(|\)| )*).*$"
•The regular expression on a $email_address command is assumed to produce a named subexpression (backreference) with name EMAILTO. In this case the text file will be the e-mail body.
•The regular expression on a $fax_receiver command is assumed to produce a named subexpression (backreference) with name ROUTETO.
•The regular expression on a $var_def command is assumed to produce a named subexpression (backreference) which must have a name which is the same as the variable name: For example:
$var_def USERID "REGEX:^\s*string AcctName = ""XRX_USERID"";\s*^\s*string AcctValue = ""(?<USERID>(?:[A-Za-z0-9])*).*$"
$var_def ACCTID "REGEX:^\s*string AcctName = ""XRX_ACCTID"";\s*^\s*string AcctValue = ""(?<ACCTID>(?:[A-Za-z0-9])*).*$"
•A special $var_def name of MULTIFAX receives extra processing: characters other than numbers and comma are removed from the result. This allows a regex to be constructed whose backreference includes spaces, double-quotes and newlines, as found when multiple phone numbers have been entered. The result is a simple comma-separated list of numeric phone numbers, which can be used in a pre-process to create additional FS files. For example:
$var_def MULTIFAX "REGEX:.*string PhoneNumber = (?<MULTIFAX>(?:\d|,|""|-|\+|\(| |\n|\))*);"
The regular expression is used to scan the whole multi-line text file and the ^ and $ symbols can be used to indicate the start and end of a line rather than the start and end of the text. Leading and trailing spaces are trimmed from the resulting value before it replaces the REGEX: expression on the command placed in the FS file.
A variable named SCAN_PATH is always added to the FS, containing the name of the folder which is scanned for .XSM folders.
After the FS file is created the files in the .XSM folder are archived into a ZIP file in the CALLBACK\TEMP folder and deleted from the original location. The ZIP is named with the FS number and the CopiaFacts housekeeping service should be used to delete these files at intervals.
The TIF files are amalgamated into a single file which will also be named with the FS number in CALLBACK\TEMP, from which it will be referenced in the FS file. You should also arrange to delete these files at intervals, or use $delete_options TEMP to delete them immediately.
The FS file is written to the specified TOSEND folder, unless the USR file contains an $fs_template $fax_pre-process command, in which case the FS file is written to PREPROC.