Difference between revisions of "ADE Scripting Guide Introduction"

 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Introduction=
+
[[Category: Analytica Scripting Guide]]
 +
[[Category: Analytica Decision Engine]]
 +
 
 +
<breadcrumbs>Analytica Scripting Guide > {{PAGENAME}}</breadcrumbs>
 +
 
 +
 
 +
==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).
 
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).
Line 11: Line 17:
 
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:
 
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:
  
<font color=red>'''Insert Screenshot of typescript window'''</font>
+
:[[Image:Ade scripting guide typescript win.PNG]]
  
 
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.
 
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.
Line 19: Line 25:
 
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:
 
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:
  
 +
<pre style="background:white; border:white; margin-left: 1em;">
 
   Ana.Command = “value Mpy”
 
   Ana.Command = “value Mpy”
 
   Ana.Send
 
   Ana.Send
 
   TheResult = Ana.OutputBuffer
 
   TheResult = Ana.OutputBuffer
 +
</pre>
  
 
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.
 
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.
Line 32: Line 40:
 
When commands and syntax are presented in this document, you will see examples like this:
 
When commands and syntax are presented in this document, you will see examples like this:
  
   Example> '''show mpy'''
+
<pre style="background:white; border:white; margin-left: 1em;">
 +
   Example> show mpy
 
   variable Mpy
 
   variable Mpy
 
   Title: miles per year
 
   Title: miles per year
Line 41: Line 50:
 
   Nodesize: 52,24
 
   Nodesize: 52,24
 
   Example>
 
   Example>
 +
</pre>
  
 
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.
 
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.
Line 46: Line 56:
 
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:
 
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
+
:<code>show mpy</code>
  
 
and the response would return as:
 
and the response would return as:
  
 +
<pre style="background:white; border:white; margin-left: 1em;">
 
   variable Mpy
 
   variable Mpy
 
   Title: miles per year
 
   Title: miles per year
Line 57: Line 68:
 
   Nodelocation: 208,48
 
   Nodelocation: 208,48
 
   Nodesize: 52,24
 
   Nodesize: 52,24
 +
</pre>
 +
 +
==See Also==
 +
* [[Typescript]]
 +
 +
 +
<footer>Title Page / {{PAGENAME}} / Objects and Their Attributes - Part 1 of 3 </footer>

Latest revision as of 23:02, 18 March 2016



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:

Ade scripting guide typescript win.PNG

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


Comments


You are not allowed to post comments.