Working with Scripts


The Pro Script module extends Mira's image processing capabilities using a scripting language based on the Lua language (see http://www.lua.org ). This provides a complete script processing engine that utilize or extend Mira's image and data processing capabilities or perform general computing tasks that do not involve Mira tools or images. For example, a script might perform tasks such as automating a complex imaging procedure, evaluating prototypes for different processing algorithms, computing a Taylor series and saving the results to a text file, or updating a semester calendar using rules based on the date of first class meeting.

Complete documentation on script functions, classes, methods, and other features, is found in the Mira MX x64 Script User's Guide which can be viewed in several ways:

Overview

For viewing, creating, and modifying scripts, Mira provides the Script Editor. The Script Editor is a text editor window that allows you to create, edit, and run scripts. The editor highlights different lua language elements according to rules that make the script syntax easier to understand, although the colors and fonts are not actually part of the script itself. This can be seen by viewing the script in a plain text editor. Scripts can be created and edited external to Mira sign various available editors, such as Notepad++ , which also supports syntax highlighting for Lua scripts. Since a lua script is simply a text file, scripts created outside Mira can be opened, edited, and executed from inside Mira.

From the Script Editor Window, scripts can be executed, or "run", using the[ ! ] button on the Window Toolbar. Scripts also can be executed using the same button on Mira's Main Toolbar and from the Script Manager.

Mira runs a script by either opening it directly from its text file or from text in the Script Editor. The script text is fed to the Lua engine, which compiles the text to byte code and executes it. The sections below describe how to create, open, save, and run scripts in Mira.

Creating a Script

To create a new script, do one of the following. These actions open an empty Script Editor:

Opening an Existing Script

To open a script from a file, do one of the following. These actions load the existing script into a Script Editor:

Saving a Script

Scripts are saved to text files with a lua file extension. You can choose to save scripts in the ...\Mira Pro 8 x64\Scripts folder tree or anywhere in your file system. If you choose To save them outside the ...\Mira Pro 8 x64\Scripts folder tree, then they will not be accessible from the Script Manager. To save a script, use one of the following methods:

Running a Script

For detailed information about running a script, see Running Scripts. Essentially, there are 3 ways to run a script:

Related Topics

Contents, Script Editor, Script Manager, Running Scripts