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. You can open, use, and save scripts to and from any folder on the computer, but the Script Manager is useful for organizing your scripts into a single location. It also provides access to the sample scripts provided with the Mira installation.

The Script manager is opened using the Script Manager command in the drop menu below the button on the Main Toolbar. The button itself a script when an Image or Plot window is top-most. The down arrow access other script functions.

Script Groups

If your scripts refer to other script files, Mira provides a shortcut to long path names by keeping anything used by the Script Manager inside the folder named

     C:\Documents and Settings\All Users\Application Data\Mirametrics\Mira Pro 8 UE\Scripts.

A script can access files inside this folder by calling the script Include() method with only a subfolder and a file name. The folders below the level of ...\Mira Pro 8 UE\Scripts are as follows:

Mira can load script files from these 3 subfolders using a function call like Include("Classes\\CImage.lua"). This works for scripts located in any particular folder, since Mira appends the argument of theInclude() method to the path to the [folder]\Scripts folder, where folder is C:\Documents and Settings\All Users\Application Data\Mirametrics\Mira Pro 8 UE\Scripts (see Mira's Special Folders). Keeping your actual scripts inside [folder]\Scripts is simply a way to organize them and be able to access them from the Script Manager.

In general, you can open, use, and save scripts to any folder on your computer and not even use the Script Manager. However, the script Include() function always refers to C:\Documents and Settings\All Users\Application Data\Mirametrics\Mira Pro 8 UE\Scripts.

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 special folders used by scripts are 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.

Button:

Function:

[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

Working with Scripts, Script Editor, Running Scripts, Mira's Special Folders