Working with Scripts
The Mira Pro Script module extends Mira's
capabilities for image processing and general computational
applications by adding classes and functions to the Lua
language (see
https://lua.org). This provides a complete
program extension facility that utilizes Mira's image and data
processing capabilities as well as general computing tasks that do
not involve Mira tools. Scripts are not required to use Mira's
built-in image processing capabilities. For example, a script might
be used to automate a complex image processing procedure, evaluate
prototypes for different processing algorithms, create a 2-D
mathematical simulation or model, or do something completely
different, like update a semester course calendar based on the date
of first class meeting.
Complete documentation on script functions,
classes, methods, and other features is found in the
Mira Pro x64 Script User's Guide which
can be viewed in several ways:
-
Launch the online
Mira Pro x64 Script User's Guide in a
browser from any computing platform
-
Open the Windows-based Mira Pro x64 Script
User's Guide from its desktop icon or the Help menu in Mira Pro
x64.
Overview
A Lua script file is simply a text file with the
.lua file type extension that Mira
interprets as containing a Lua script. For viewing, creating, and
modifying scripts, Mira provides the
Script Editor Window, which is a syntax highlighting
text editor that provides color and other markup to highlight
various elements of the script. This effect can be viewed by
comparing the same script file in the Mira Script Editor
Window with a plain text editor like Notepad. Scripts
can be created and edited outside Mira using Notepad or another
editor, but must be run (or executed) from inside Mira. External
editors that support syntax highlighting for the Lua language
include
Notepad++ and
SciTE, both of which are currently available at
no cost.
Scripts are run (or executed) using the
[!] button on the toolbar at the top
of the Script Editor Window and Main Toolbar, and
from the
Script Manager. Mira feeds the script text to the Lua
engine, which then compiles the text to byte code and executes it.
Running compiled code has benefits over interpreted scripts,
including execution speed and detection of syntax errors before
execution begins.
Opening a Script
To open a script from a file, do one of the
following. These actions load the existing script into a Script
Editor:
-
Use the File > Open command
(Ctrl+O) and choose Lua Script File (*.lua) from the File Types drop box. Select the script file and
click [Open].
-
Click the down-arrow on the button on the main toolbar, and select [Script Manager]. In the Script Manager
dialog, select a script and click the [Open] button.
-
Select a .lua file
from the MRU (Most Recently Used) files list at the bottom of the
File menu.
-
Drag a .lua file
from Windows Explorer and drop it onto the Mira window.
Running a Script
There are several ways to run a script. Use the
method that is appropriate:
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:
Creating a New Script
To create a new script, do one of the following.
These actions open an empty Script Editor:
-
Execute the File > New command
(Ctrl+N) and select Script Document as the new document type. Double
click the document type or click [OK]
to create the new script document.
-
Click the down-arrow on the button on the main toolbar, and select [Script Manager]. In the Script Manager
dialog, click [New].
Related Topics
Contents
Script Editor
Script Manager
Edit Script Keywords
Mira Pro x64 User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All
Rights Reserved.
|