Scripting Introduction

<< Click to Display Table of Contents >>

Navigation:  Advanced >

Scripting Introduction

Included with ThinkAutomation is a powerful Scripting module. This allows you to create custom scripts that are executed by the ThinkAutomation Server as it processes messages. Scripts are written using the BASIC programming language. The syntax is compatible with Microsoft Visual Basic 6. This manual is not intended to teach the Visual Basic language (there are dozens of books for that). It is only intended to show how scripts can be used within ThinkAutomation.


Scripts can be as complex as you need and contain many Functions and Sub-Procedures. Scripts can also use external COM objects. For example, you could use the ADO objects (ActiveX Data Objects) to access and update data sources.


Within scripts ThinkAutomation allows you to access information about the current message being processed via simple properties.


The ThinkAutomation Server executes three types of scripts:


1. Trigger Condition Scripts

Are fired on the Edge Server when ThinkAutomation downloads new messages & checks the message to see if it should be processed. These scripts can be used to fine tune Trigger conditions.


2. Field Extraction Scripts

These scripts can be assigned to individual fields that you extract from the Email. They can be used to perform complex field extraction or to create calculated fields or to format fields that have already been extracted.


3. Action Scripts

These scripts are fired by the Message Processor Server when the message Actions are processed. These scripts can be used to perform custom actions.



The Script Editor

All scripts are edited using the ThinkAutomation Script Editor




The code editing window features 'Intellisense' typing - showing the attributes of the current Basic keyword. You can also press F1 on any keyword to view the language help.



Scripts can be debugged in the code editor. Click in the left margin to set a 'break point' against a specific line and click the Run button.




You can step through the code by clicking the Step Into button (or pressing F8). In the Immediate tab you can view contents of variables by typing ? {variable}


Adding References

Click the Add Reference button to list the available COM objects that you can use in your scripts:




Once added you can create and use the objects.


Below is a sample script that uses the ADO library to open and manipulate a SQL Server database.








ThinkAutomation © Parker Software 2016