info.mailtraq.com > Management > Scripting Syntax Scripting SyntaxThe script language provides a simple, flexible and powerful means of customising and extending the features and flexibility of Mailtraq. Whilst it is true to say that some things can only be carried out in Mailtraq by using scripts it is not necessary to learn the script language in order to operate Mailtraq successfully. A script consists of a sequence of expressions stored in an ASCII text file in the scripts folder with an extension of .MTQ which Mailtraq reads off disk, interprets and executes on demand. The expressions in scripts are assembled from functions, variables and operators. Functions provide the core of the script language and there is extensive support for message handling. Variables, which are not typed (i.e. they have no declared data type; string, integer, etc), can be created at will and are used to hold information and to store the results of functions. The normal set of operators provide facilities to add, subtract, multiple and divide numbers, etc. The syntax for scripts is not complex and can be learned readily without prior experience, though someone versed in a macro language or other programming languages will grasp the essentials more readily. Select one of the following for further information:- Getting Started with Scripts Script Syntax Script Style Guide Scripting Functions A-Z Help with Scripting Scripts can be triggered in a variety of ways. The simplest is provided by the Run Script facility available from the File Menu of the console which instructs Mailtraq to run the selected script immediately. Scripts can also be triggered by the arrival of incoming or outgoing messages, by the contents of particular headers or the identity of the sender or recipient during message routing, or by creating a schedule which runs a script at a certain time of the day, or on a certain day of the week or month. Mailtraq scripts are capable of performing many intricate tasks but they do not constitute a programming language in their own right. Functions are provided in the script language, however, which can launch and interact with custom written programs to enable Mailtraq's functionality to be extended in ways limited only by the imagination of the user. Mailtraq can also operate in a limited manner as a DDE Server enabling external applications to launch scripts on demand. Mailtraq templates are implemented as a combination of text and script expressions. The standard templates also provide valuable insight into the capabilities and syntax of scripts and studying them is highly recommended. |