Script Manager


The Script Manager provides the standard file management functions for scripts, such as edit, delete, rename, etc. and also provides a means for executing scripts. The command buttons in the right border of the window perform the usual functions. The active script is the one selected into the text box above the list.

The Script Manager is opened using the Script Manager command in the drop menu below the button on the Main Toolbar.

Script Groups

If your scripts refer to other script files, Mira provides a shortcut to long path names by keeping classes inside a directory tree starting at [Mira]\Scripts (where [Mira] refers to the name of your Mira installation folder). A script can access files inside this folder by calling the script Include() method with only a subfolder and file name. The folders below the level of [Mira]\Scripts are as follows:

bullet.gif    Classes

bullet.gif    Include

bullet.gif    Samples

Mira scripts can load files from these 3 subfolders using a call like Include("Classes\\CMyImage.lua") to load your class CMyClass.lua. This works for scripts located in any particular folder, since Mira automatically prefixes the specified path (i.e., what you pass between "") with the path to the [Mira]\Scripts folder. Keeping scripts inside the [Mira]\Scripts folder is not required; it is simply a way to organize them and be able to access them from the Script Manager.

tip

Notice that the Include() statement above uses a double backslash inside the quoted string. In a literal string between quotes "", Windows assumes that a single backslash precedes a special character, such as a newline \n or a tab\t. In all of your scripts, you need to use a double backslash \\ in literal strings when you want the string interpreted as using a single backslash character\.

The Script Manager works with files in the top level Scripts folder and its 3 subfolders named above. If you use Windows Explorer to look inside the Mira installation folder, you will see theScripts folder and its subfolders. The use of these folders is described in the following table.

Script Groups

Scripts

This group contains the script files that you execute. Depending upon the script content, it may be global or it may operate on the view class that is active when the Script Manager is open. For example, if an Image Window is on top when you open the Script Manager, then executing a class script (one that uses a Mira class as input), would use that image window and have access to the images displayed in it.

Include

This group contains "helper" script files that include functions or definitions used by other script files. These files cannot be executed on their own but must be inserted into scripts using the Include function. For example, LoadImages.lua is an include script; it does nothing by itself but, when included into a script, the function call V = LoadImages(n) opens and displays up to n images from files and returns them to the script as a reference to a newCImageView object V.

Classes

This group contains Lua classes that form an object-oriented interface between Mira and the script engine.

Samples

This group contains the sample scripts that come with the Mira Pro Script Module.

tip

Script files may be located anywhere in the file system. However, the Script Manager can access them only if they are located in one of these 4 folders.

Script Manager Buttons

The buttons on the right side of the Script Manager have functions described in the following table. They work with the script that is selected (highlighted) in the central list box in the dialog.

Run

Executes the script.

Open

Opens the script into a Script Editor.

New

Creates a new, empty script in a Script Editor.

Rename

Renames the selected script. This changes the name of the file where the script is saved.

Delete

Deletes the file containing the selected script.

Close

Closes the Script Manager.

Related Topics

Contents

Script Editor

Working with Scripts

Script Editor Window

Running Scripts shown in the User's Guide


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.