Scripts allow us to write programs for
execution within Manifold using a variety of built in and supported languages.
Scripts can be edited when they are opened in a Script
window. In addition, IronPython and IronRuby can be edited and executed
from the Command
window, using the Command window as a REPL (Read-Eval-Print
Loop) console. Add-ins
to extend Manifold with new commands can also be written using scripts.
Two ways to create and run scripts - In Manifold, we have two ways to write scripts:
Choose Create - New Script to create a new, blank script and then double-click that new script to open it in a Command Window. Creating a new script component in the Project ensures that whatever we write into that script will be saved as part of the Project. Any edits we make in the Command Window will be automatically saved into that script.
Choose View - New Command Window - <scripting language> to launch a Command Window for that scripting language. Launching a Command Window allows us to write scripts to do simple things quickly in situations where we do not want to create a script component in the project for later use. New scripts created within the Command Window disappear when the Command Window is closed. If we end up writing something more elaborate that we decide we want to keep, we can copy the text and paste it into a new script component created in the project.

Must read info: All programmers should review the API Documentation online. The API Documentation provides total details on the API and also provides hundreds of examples, many of which are provided side-by-side in three versions, in C#, in VBScript and in IronPython.
We can also write a temporary script in a limited selection of languages that are installed, which will appear as choices of <scripting language> in the View - New Command Window command. See the discussion in the View - New Command Window topic.
New scripts created within the Command Window disappear when the Command Window is closed. To save the script, copy the text and paste it into a new script component created in the project.
For tips on editing the text of scripts in the Command Window, see the Editing Queries, Scripts and Comments topic.
Running a script:

In the main menu choose File - Create - New Script or right-click an empty spot in the Project pane and choose Create - New Script.

Choose the language for the script from the pull down menu.
Name |
Name for the script. "Script" by default. Specify a more informative name as desired. |
Language |
Choose the desired language for the script. |
Create script |
Create the new script. |
Edit Query |
We can write SQL in a query that creates other components. For example, we can write a query that creates a table and a drawing. We can also write a query that creates a new query component.
The Edit Query button launch the Command Window loaded with a query that creates a new query using the given name. This is a a great way to learn how to use SQL to create queries. |
Cancel |
Exit the dialog without doing anything. |
See examples in the Scripts topic.
Agnosticism - Manifold is completely agnostic about programming languages, as can be seen by the wide range of languages which are directly supported for scripting in Manifold. The Manifold Command Window by default supports both IronPython and IronRuby to provide stylish alternatives to JavaScript. C#, JScript, JScript.NET, VB.NET and VBScript are supported and are always available because of the Microsoft infrastructure required for a Manifold installation. Manifold also supports F#, PerlScript and PythonScript, which are easy to install if desired.
Documentation - For information on scripting, see the Manifold API Documentation website.
Editing Queries, Scripts and Comments
Command Window - Query Builder
Example: Create and Run a JScript.NET Script - How to create and run simple JScript.NET scripts.
Example: VBScript to Create Locations from a Table - Use VBScript to take a table where each record has a name, scale, latitude and longitude and for each record create a Location component in the project.