ADE Scripting Guide Introduction
Introduction
Analytica contains a powerful scripting language for retrieving and modifying information contained in Analytica models. The scripting language is fully accessible from within Analytica (through the use of Analytica’s Typescript Window or by using the Command and Send properties of the CAEngine interface of the Analytica Decision Engine (ADE).
The Typescript Window
Hidden underneath the user-friendly graphical user interface of Analytica, your model is a network of objects with associated attributes, and a rich command language with which to manipulate them. The Typescript window provides access to this object-oriented system, from directly within the Analytica application. From this window, you can enter commands and see the results immediately. Later on, as you are developing a program with ADE, the very same interactive language will be used through the Command and Send properties of ADE’s CAEngine interface.
To Open the Typescript window from within Analytica
To open the typescript window from within Analytica, hold down the Control key and the single-quote key simultaneously. The following typescript window will appear:
The Typescript window, similar to a TTY console, displays all commands entered in Analytica, and the corresponding output. At the bottom of the window is a command prompt. When you enter commands at this prompt, the command and its response are added to the bottom of the window.
To Use Typescript from a program making use of ADE
Using ADE, one can access Analytica’s typescript language through the use of the Command and Send properties of the CAEngine interface. So, if one wanted to get the result of the Mpy variable in the currently opened model, they would do the following:
Ana.Command = “value Mpy” Ana.Send TheResult = Ana.OutputBuffer
Note that since the result returned by the OutputBuffer property of CAEngine is of the same form that you will see in the typescript window, you may have to parse through the tabs and newlines in the result in order to get at the meaningful part of the result. All other methods of the Analytica Decision Engine, other than Command and Send, automatically parse the result for you.
For more information about using typescript commands with the Analytica Decision Engine, please consult the Analytica Decision Engine for Windows Developers Guide.
Conventions used in this guide
This guide will show you many examples for communicating wit the Analytica application using scripts. For consistency, most examples will be in the form that you can use in the Typescript window. When commands and syntax are presented in this document, you will see examples like this:
Example> show mpy variable Mpy Title: miles per year Units: Miles/year Description: Annual mileage driven Definition: 12K Nodelocation: 208,48 Nodesize: 52,24 Example>
The part “Example>” is the prompt. The bold test represents text that you type at this prompt. The text following the command and before the next prompt is the response.
Scripts and inter-application communications (IAC, described later in this document) are protocols for performing the same commands you would enter at the prompt, and the output returned through communications are the same as what Analytica would return in the Typescript window. As in the example above, you would execute a script in Analytica, or send a script to Analytica specified as:
show mpy
and the response would return as:
variable Mpy Title: miles per year Units: Miles/year Description: Annual mileage driven Definition: 12K Nodelocation: 208,48 Nodesize: 52,24
See Also
Enable comment auto-refresher