Using Scripts with Indexing Profiles
Using Scripts with Indexing Profiles
Indexing Profiles
www.therefore.net
© 2013 Therefore Corporation
ados.com
© 2013 Therefore Corporation
All rights reserved. No parts of this work may be reproduced in any form or by any means -
graphic, electronic, or mechanical, including photocopying, recording, taping, or information
storage and retrieval systems - without the written permission of the publisher.
Any other 3rd Party Products that are referred to in this document, are the property of, and
may be either trademarks and/or registered trademarks of the respective owners in the USA
and/or other countries. The publisher and the author make no claim to these trademarks.
While care has been taken in the preparation of this document, the publisher and the author
assume no responsibility for errors or omissions, or for damages resulting from the use of
information contained in this document.
VERSION: 2013 - 05
Log: 02
Added more sample scripts
Log:03
Not vallid anymore.
Log: 04
Corrected a script and removed tabs which were causing problems when copying.
Log: 05
Corrected a script and added info on doing assignments for Capture Client profiles where the
Category is set at runtime.
Contact: [email protected]
Table of Contents
1. Introduction .........................................................................................4
2.1 Fetching
......................................................................................................................................5
the correct date
2.2 Fetching
......................................................................................................................................5
the correct Money Format
2.3 Splitting
......................................................................................................................................6
a delimited list
2.4 Replacing
......................................................................................................................................6
charaters
2.5 Read
......................................................................................................................................6
a part of the text by using the mask
3.1 Restricting
......................................................................................................................................8
an indexing profile to a certain template
3.2 Extracting
......................................................................................................................................9
certain index data from the body of an e-mail
3.3 Extracting
......................................................................................................................................10
data from a PDF attachment of known structure
4. Therefore™ Capture
.........................................................................................11
Client Profiles
4.1 Setting
......................................................................................................................................11
a category using characters from barcode
4.2 Extracting
......................................................................................................................................12
index data from a part of a barcode
5. Therefore™ Document
.........................................................................................14
Loader Profiles
5.1 Importing
......................................................................................................................................14
line items
5.2 Defining
......................................................................................................................................15
the files that will be saved to Therefore™
6. Therefore™ Content
.........................................................................................17
Connector Profiles
6.1 Defining
......................................................................................................................................17
files that will be processed
6.2 Extracting
......................................................................................................................................17
index data from a folder structure
6.3 Extracting
......................................................................................................................................19
index data from a file name
1. Introduction
From Therefore™ 2013 indexing profiles support the use of scripting (VBScript). The purpose of this
whitepaper is to document some of the most common things that can be achieved with scripting.
Please note that this document does not explain VBScript in depth and assumes that
you are familiar with it. For a complete documentation of VBScript please refer to the
Microsoft Download Center: http://www.microsoft.com/en-us/download/details.aspx?
id=2764
Please be aware that copying and pasting the scripts could cause formatting problems.
2. General Scripts
2.1 Fetching the correct date
Where the date format on the documents to be imported differs from the date on the operating
system, the ToDate function can be used. For example if the documents have a date with format
DD.MM.YYYY but the system uses another format then in the assignment you could use:
55
General Scripts
Dim SplitList
'split the list
SplitList = Split(Barcode.GetValue("Barcode1"), ",")
Dim Replaced
Dim example
'replace characters
example ="example!"
Replaced = Replace(example, "!","?")
where "*" represents 'any text', the "?" represents the section to be extracted and "Invoice
Number" is the name of an extracted string.
77
Microsoft® Office Profiles
New Order
Company Name: Brightridge University
Company Address: 4 Highridge Road, Brightridge, 4568, River County
Order:
ITEM CODE PRICE/UNIT QTY TOTAL
T345 5.00 10 50.00
SUBTOTAL 50.00
Sales Tax 5.00
Total 55.00
The script to extract Company Name, Company Address and Amount would be:
Dim Name
Dim Address
Dim Amount
Dim AmountTemp
99
Microsoft® Office Profiles
The first setp is to create a file profile with PDF extractor to extract text from the PDF using zonal OCR. In our
case this profile has the name "PDFOrders" (ID:243).
Dim attachments
Dim attachmentNo
'set the attachment no. "0" is first, "1" is second etc.
attachmentNo = 0
'check if there are attachments. If there are then get the specified attachment
if AttachmentCount = 0 then
NotApplicable()
else
attachments = GetAttachments()
'Execute the defined profile. This can be the name or the number
'Using the name of the profile
ExecuteProfile "PDFOrders", attachments(attachmentNo)
Dim myBarcode
'Get the barcode value
myBarcode = Barcode.GetValue("Barcode1")
11
11
Therefore™ Capture Client Profiles
You can get the category number in the Solution Designer under category properties.
You can also assign index values to these Categories. Right click on Categories Field header
and choose Add Assignments. Then choose the categories you would like to add assignments
for and then add assignments as per normal. The assignments will then be done at run-time.
Mid(GetValue("Barcode1"), 1, 9)
If this was a date then you could also use the ToDate function to make sure that it is converted
correctly. e.g.
ToDate(Mid(GetValue("Barcode1"),1,9),"DD/MM/YYYY")
Note: the Assignment will be marked in red, since the Barcode cannot be read at design time.
13
13
Therefore™ Document Loader Profiles
Hallo 2
Welt
3
Consider also that the line item part of the XML file looks like this:
<myTable>
<Text> Hallo </Text>
<Number> 2 </Number>
</myTable>
<myTable>
<Text> Welt </Text>
</myTable>
<myTable>
<Number> 3 </Number>
</myTable>
ExtractListTable("Text,"MyTable")
ExtractListTable("Number,"MyTable")
Please note that this is a mandatory script that needs to be specified for defining the
files that are going to be saved. For more details please refer to Administration
Manual.
Files that will be saved to Therefore™ need to be specified in the initialization script. This is done
using a script:
FilesToSave=ExtractList("FileName")
15
15
Therefore™ Document Loader Profiles
where FileName is the XML tag that defines the name of a file.
File.GetPath(0)
17
17
Therefore™ Content Connector Profiles
where 0 defines the folder level and the level 0 is the parent folder of a file.
19
19